diff --git a/CHANGELOG.md b/CHANGELOG.md
index ed7babfb0..b00298145 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -101,6 +101,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Bug fixes
+- [#984](https://github.com/alleslabs/celatone-frontend/pull/984) Exclude non block number from searching block in lite
- [#974](https://github.com/alleslabs/celatone-frontend/pull/974) Fix tx by account addr lcd to support new cosmos sdk
- [#976](https://github.com/alleslabs/celatone-frontend/pull/976) Support save accounts in lite version
- [#944](https://github.com/alleslabs/celatone-frontend/pull/944) Fix asset input selector
diff --git a/src/lib/layout/Searchbar.tsx b/src/lib/layout/Searchbar.tsx
index 1f1533803..4dc77fbdb 100644
--- a/src/lib/layout/Searchbar.tsx
+++ b/src/lib/layout/Searchbar.tsx
@@ -1,3 +1,4 @@
+/* eslint-disable sonarjs/no-duplicate-string */
import {
Button,
chakra,
@@ -16,7 +17,7 @@ import {
useDisclosure,
useOutsideClick,
} from "@chakra-ui/react";
-import { useCallback, useRef, useState } from "react";
+import { useCallback, useMemo, useRef, useState } from "react";
import type { ChangeEvent, KeyboardEvent } from "react";
import { trackUseMainSearch } from "lib/amplitude";
@@ -131,6 +132,19 @@ const ResultItem = ({
onClose,
}: ResultItemProps) => {
const route = getRouteOptions(type)?.pathname;
+ const isAccountAddress =
+ type === "Account Address" || type === "Contract Address";
+ const displayValue = useMemo(() => {
+ if (isAccountAddress) {
+ return metadata.icns.address || metadata.initiaUsername.address || value;
+ }
+ return value;
+ }, [
+ isAccountAddress,
+ metadata.icns.address,
+ metadata.initiaUsername.address,
+ value,
+ ]);
const normalizedIcnsValue = value.endsWith(`.${metadata.icns.bech32Prefix}`)
? value
: `${value}.${metadata.icns.bech32Prefix}`;
@@ -155,10 +169,8 @@ const ResultItem = ({
onClose?.();
}}
>
-
- {metadata.icns.address || metadata.initiaUsername.address || value}
-
- {metadata.icns.icnsNames?.primaryName && (
+ {displayValue}
+ {isAccountAddress && metadata.icns.icnsNames?.primaryName && (
@@ -184,7 +196,7 @@ const ResultItem = ({
)}
)}
- {metadata.initiaUsername?.username && (
+ {isAccountAddress && metadata.initiaUsername?.username && (
)}
@@ -314,9 +326,12 @@ const Searchbar = () => {
if (type === "Module Path") {
return splitModule(keyword) as [Addr, string];
}
- return (
- metadata.icns.address || metadata.initiaUsername.address || keyword
- );
+ if (type === "Account Address")
+ return (
+ metadata.icns.address || metadata.initiaUsername.address || keyword
+ );
+
+ return keyword;
};
trackUseMainSearch(isClick, type);
diff --git a/src/lib/services/searchService.ts b/src/lib/services/searchService.ts
index 1e1246f45..f9f1af23e 100644
--- a/src/lib/services/searchService.ts
+++ b/src/lib/services/searchService.ts
@@ -165,9 +165,10 @@ export const useSearchHandler = (
isPosDecimal(debouncedKeyword) && isFullTier
);
const { foundBlock, isFetching: blockFetching } = useMemo(() => {
- if (!isFullTier) return { foundBlock: true, isFetching: false };
+ if (isPosDecimal(debouncedKeyword) && !isFullTier)
+ return { foundBlock: true, isFetching: false };
return { foundBlock: blockApi.data, isFetching: blockApi.isFetching };
- }, [blockApi, isFullTier]);
+ }, [blockApi.data, blockApi.isFetching, debouncedKeyword, isFullTier]);
// Proposal
const { data: proposalApiData, isFetching: proposalApiIsFetching } =