Skip to content

Commit

Permalink
chore(apps/staking): Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
nevendyulgerov authored and brunomenezes committed Dec 4, 2024
1 parent de296e0 commit f468e6e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions apps/staking/src/pages/blocks/[[...block]].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ const Blocks: FC<BlocksProps> = ({ chainId }) => {
// TODO: use blockId
blockId = blockId && blockId.length > 0 ? (blockId[0] as string) : '';

const [searchKey, setSearchKey] = useState<string>(blockId);
const [debouncedSearchKey, setDebouncedSearchKey] = useState(searchKey);
const [debouncedSearchKey, setDebouncedSearchKey] = useState(blockId);

// list of all blocks, unfiltered
const all = useBlocks(undefined, 20);
Expand Down Expand Up @@ -155,7 +154,6 @@ const Blocks: FC<BlocksProps> = ({ chainId }) => {
onSearchChange={(e) => {
const nextValue = e.target.value;
debounced(nextValue);
setSearchKey(nextValue);
}}
/>
</PageHeader>
Expand All @@ -164,7 +162,7 @@ const Blocks: FC<BlocksProps> = ({ chainId }) => {
<BlocksChart result={all} />
</HStack>

{!searchKey && (
{!debouncedSearchKey && (
<BlockList
chainId={chainId}
result={all}
Expand All @@ -178,7 +176,7 @@ const Blocks: FC<BlocksProps> = ({ chainId }) => {
chainId={chainId}
result={byProducer}
filterField="producer"
filterValue={searchKey}
filterValue={debouncedSearchKey}
w="100%"
px="6vw"
py="5"
Expand All @@ -188,7 +186,7 @@ const Blocks: FC<BlocksProps> = ({ chainId }) => {
chainId={chainId}
result={byNode}
filterField="node"
filterValue={searchKey}
filterValue={debouncedSearchKey}
w="100%"
px="6vw"
py="5"
Expand Down

0 comments on commit f468e6e

Please sign in to comment.