diff --git a/src/components/TransactionsTab/TransactionsTab.tsx b/src/components/TransactionsTab/TransactionsTab.tsx index 346879a1b..3b0755f91 100644 --- a/src/components/TransactionsTab/TransactionsTab.tsx +++ b/src/components/TransactionsTab/TransactionsTab.tsx @@ -48,6 +48,7 @@ import { ClearTransactionsButton, } from "./TransactionsTab.styles"; import AnimatedWalletTransaction from "./subcomponents/AnimatedWalletTransaction/AnimatedWalletTransaction"; +import { clearLocalStorage } from "./helpers/clearLocalStorage"; type TransactionsTabType = { address: string; @@ -159,6 +160,7 @@ const TransactionsTab = ({ const handleClearTransactions = () => { dispatch(setTransactions(null)); + clearLocalStorage('airswap/transactions') }; return ( diff --git a/src/components/TransactionsTab/helpers/clearLocalStorage.ts b/src/components/TransactionsTab/helpers/clearLocalStorage.ts new file mode 100644 index 000000000..1326468c7 --- /dev/null +++ b/src/components/TransactionsTab/helpers/clearLocalStorage.ts @@ -0,0 +1,8 @@ +export const clearLocalStorage = (prefix: string) => { + for (let i = 0; i < localStorage.length; i++) { + const key = localStorage.key(i); + if (key?.startsWith(prefix)) { + localStorage.removeItem(key) + } + } +}