diff --git a/src/abacus-ts/lib/createStoreEffect.ts b/src/abacus-ts/lib/createStoreEffect.ts index 0857b36e3..11e2bd318 100644 --- a/src/abacus-ts/lib/createStoreEffect.ts +++ b/src/abacus-ts/lib/createStoreEffect.ts @@ -18,6 +18,7 @@ export function createStoreEffect( lastCleanup = handleChange(thisValue); } }); + return () => { lastCleanup?.(); removeStoreListener(); diff --git a/src/abacus-ts/rest/lib/indexerQueryStoreEffect.ts b/src/abacus-ts/rest/lib/indexerQueryStoreEffect.ts index 3d68fd562..22783a72b 100644 --- a/src/abacus-ts/rest/lib/indexerQueryStoreEffect.ts +++ b/src/abacus-ts/rest/lib/indexerQueryStoreEffect.ts @@ -41,9 +41,7 @@ export function createIndexerQueryStoreEffect( config: QuerySetupConfig ) { const fullSelector = createAppSelector( - selectWebsocketUrl, - selectIndexerUrl, - config.selector, + [selectWebsocketUrl, selectIndexerUrl, config.selector], (wsUrl, indexerUrl, selectorResult) => ({ infrastructure: { wsUrl, indexerUrl }, queryData: selectorResult, diff --git a/src/abacus-ts/socketSelectors.ts b/src/abacus-ts/socketSelectors.ts index eec7b7d49..2cc5da442 100644 --- a/src/abacus-ts/socketSelectors.ts +++ b/src/abacus-ts/socketSelectors.ts @@ -7,18 +7,17 @@ import { getSelectedNetwork } from '@/state/appSelectors'; import { createAppSelector } from '@/state/appTypes'; const suffix = '/v4/ws'; -export const selectWebsocketUrl = createAppSelector(getSelectedNetwork, (network) => { +export const selectWebsocketUrl = createAppSelector([getSelectedNetwork], (network) => { const endpointsConfig: EndpointsConfig = ENVIRONMENT_CONFIG_MAP[network].endpoints; return `${endpointsConfig.indexers[0]!.socket}${suffix}`; }); -export const selectIndexerUrl = createAppSelector(getSelectedNetwork, (network) => { +export const selectIndexerUrl = createAppSelector([getSelectedNetwork], (network) => { const endpointsConfig: EndpointsConfig = ENVIRONMENT_CONFIG_MAP[network].endpoints; return `${endpointsConfig.indexers[0]!.api}`; }); export const selectParentSubaccountInfo = createAppSelector( - getUserWalletAddress, - getUserSubaccountNumber, + [getUserWalletAddress, getUserSubaccountNumber], (wallet, subaccount) => ({ wallet, subaccount }) ); diff --git a/src/abacus-ts/websocket/orderbook.ts b/src/abacus-ts/websocket/orderbook.ts index 0ceb9171b..0bbef85f1 100644 --- a/src/abacus-ts/websocket/orderbook.ts +++ b/src/abacus-ts/websocket/orderbook.ts @@ -66,8 +66,7 @@ function orderbookWebsocketValue( } const selectMarketAndWsInfo = createAppSelector( - selectWebsocketUrl, - (state) => state.perpetuals.currentMarketId, + [selectWebsocketUrl, (state) => state.perpetuals.currentMarketId], (wsUrl, currentMarketId) => ({ wsUrl, currentMarketId }) ); diff --git a/src/abacus-ts/websocket/parentSubaccount.ts b/src/abacus-ts/websocket/parentSubaccount.ts index b753e3575..af8f90e43 100644 --- a/src/abacus-ts/websocket/parentSubaccount.ts +++ b/src/abacus-ts/websocket/parentSubaccount.ts @@ -166,8 +166,7 @@ function accountWebsocketValue( } const selectParentSubaccount = createAppSelector( - selectWebsocketUrl, - selectParentSubaccountInfo, + [selectWebsocketUrl, selectParentSubaccountInfo], (wsUrl, { wallet, subaccount }) => ({ wsUrl, wallet, subaccount }) );