From 0857d538fea8474897706b3cdd0557a1ea753a8a Mon Sep 17 00:00:00 2001 From: Kieran O'Neill Date: Tue, 26 Dec 2023 15:41:36 +0000 Subject: [PATCH] feat: clear asset list when query is empty --- src/extension/modals/AddAssetModal/AddAssetModal.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/extension/modals/AddAssetModal/AddAssetModal.tsx b/src/extension/modals/AddAssetModal/AddAssetModal.tsx index 4d24affd..6817ff30 100644 --- a/src/extension/modals/AddAssetModal/AddAssetModal.tsx +++ b/src/extension/modals/AddAssetModal/AddAssetModal.tsx @@ -295,7 +295,12 @@ const AddAssetModal: FC = ({ onClose }: IProps) => { onClose(); }; const handleKeyUp = () => { - if (account && query.length > 0) { + // if the query is empty, clear assets + if (query.length <= 0) { + dispatch(clearAssets()); + } + + if (account) { // abort the previous standard assets request if (queryStandardAssetDispatch) { queryStandardAssetDispatch.abort();