Skip to content

Commit

Permalink
[ui] Drop component get from api again when the currency changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kai authored and vanminh1701 committed Oct 27, 2022
1 parent 994f8b9 commit f19db7b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/ui/src/components/Drop/List/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const Drops: React.FC<DropsProps> = ({ candyShop, wallet, walletConnectCo
const [keyword, setKeyword] = useState<string>();

const [target, setTarget] = useState<HTMLDivElement>();
const [hasMore, setHasMore] = useState<boolean>(true);
const [hasMore, setHasMore] = useState<boolean>(false);
const dropQueries = useRef({ offset: 0, limit: 12 });
const prevFilterRef = useRef(filterOption);

Expand Down Expand Up @@ -168,6 +168,12 @@ export const Drops: React.FC<DropsProps> = ({ candyShop, wallet, walletConnectCo
return () => clearTimeout(interval);
}, [dropNfts]);

useEffect(() => {
dropQueries.current.offset = 0;
setDropNfts([]);
setHasMore(true);
}, [candyShop]);

useObserver({ callbackFn: fetchDrops, triggerTargetId: 'DROP_TARGET', enable: Boolean(target && hasMore) });

const onClickCard = (item: any) => () => setDropNft(item);
Expand Down

0 comments on commit f19db7b

Please sign in to comment.