diff --git a/apps/trading/components/accounts-container/accounts-container.tsx b/apps/trading/components/accounts-container/accounts-container.tsx index bbb7567a9..df1e1dc6c 100644 --- a/apps/trading/components/accounts-container/accounts-container.tsx +++ b/apps/trading/components/accounts-container/accounts-container.tsx @@ -9,7 +9,7 @@ import type { PinnedAsset } from '@vegaprotocol/accounts'; import { AccountManager, useTransferDialog } from '@vegaprotocol/accounts'; import { useDepositDialog } from '@vegaprotocol/deposits'; import { create } from 'zustand'; -import { persist, subscribeWithSelector } from 'zustand/middleware'; +import { persist } from 'zustand/middleware'; import type { ColumnState } from 'ag-grid-community'; import { useDataGridEvents } from '@vegaprotocol/datagrid'; @@ -96,8 +96,7 @@ const useAccountStore = create<{ gridStore: Store; update: (gridStore: Store) => void; }>()( - persist( - subscribeWithSelector((set) => ({ + persist((set) => ({ gridStore: {}, update: (newStore) => { set((curr) => ({ @@ -107,7 +106,7 @@ const useAccountStore = create<{ }, })); }, - })), + }), { name: 'vega_accounts_store', } diff --git a/apps/trading/components/fills-container/fills-container.tsx b/apps/trading/components/fills-container/fills-container.tsx index 478f08566..3b625c6d0 100644 --- a/apps/trading/components/fills-container/fills-container.tsx +++ b/apps/trading/components/fills-container/fills-container.tsx @@ -3,7 +3,7 @@ import { Splash } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { FillsManager } from '@vegaprotocol/fills'; import { create } from 'zustand'; -import { persist, subscribeWithSelector } from 'zustand/middleware'; +import { persist } from 'zustand/middleware'; import type { ColumnState } from 'ag-grid-community'; import { useDataGridEvents } from '@vegaprotocol/datagrid'; @@ -53,8 +53,7 @@ const useFillsStore = create<{ gridStore: Store; update: (gridStore: Store) => void; }>()( - persist( - subscribeWithSelector((set) => ({ + persist((set) => ({ gridStore: {}, update: (newStore) => { set((curr) => ({ @@ -64,7 +63,7 @@ const useFillsStore = create<{ }, })); }, - })), + }), { name: 'vega_fills_store', } diff --git a/apps/trading/components/ledger-container/ledger-container.tsx b/apps/trading/components/ledger-container/ledger-container.tsx index 591517237..3c1e0adcf 100644 --- a/apps/trading/components/ledger-container/ledger-container.tsx +++ b/apps/trading/components/ledger-container/ledger-container.tsx @@ -5,7 +5,7 @@ import { Splash } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet } from '@vegaprotocol/wallet'; import type { ColumnState } from 'ag-grid-community'; import { create } from 'zustand'; -import { persist, subscribeWithSelector } from 'zustand/middleware'; +import { persist } from 'zustand/middleware'; export const LedgerContainer = () => { const { pubKey } = useVegaWallet(); @@ -41,7 +41,7 @@ const useLedgerStore = create<{ update: (gridStore: Store) => void; }>()( persist( - subscribeWithSelector((set) => ({ + (set) => ({ gridStore: {}, update: (newStore) => { set((curr) => ({ @@ -51,7 +51,7 @@ const useLedgerStore = create<{ }, })); }, - })), + }), { name: 'vega_ledger_store', } diff --git a/apps/trading/components/liquidity-container/liquidity-container.tsx b/apps/trading/components/liquidity-container/liquidity-container.tsx index 897d1f33b..f3169150d 100644 --- a/apps/trading/components/liquidity-container/liquidity-container.tsx +++ b/apps/trading/components/liquidity-container/liquidity-container.tsx @@ -16,7 +16,7 @@ import type { ColumnState } from 'ag-grid-community'; import type { AgGridReact } from 'ag-grid-react'; import { useEffect, useRef } from 'react'; import { create } from 'zustand'; -import { persist, subscribeWithSelector } from 'zustand/middleware'; +import { persist } from 'zustand/middleware'; export const LiquidityContainer = ({ marketId, @@ -97,7 +97,7 @@ const useLiquidityStore = create<{ update: (gridStore: Store) => void; }>()( persist( - subscribeWithSelector((set) => ({ + (set) => ({ gridStore: {}, update: (newStore) => { set((curr) => ({ @@ -107,7 +107,7 @@ const useLiquidityStore = create<{ }, })); }, - })), + }), { name: 'vega_ledger_store', } diff --git a/apps/trading/components/positions-container/positions-container.tsx b/apps/trading/components/positions-container/positions-container.tsx index b143b2bf4..e3671da5c 100644 --- a/apps/trading/components/positions-container/positions-container.tsx +++ b/apps/trading/components/positions-container/positions-container.tsx @@ -5,7 +5,7 @@ import { Splash } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet } from '@vegaprotocol/wallet'; import type { ColumnState } from 'ag-grid-community'; import { create } from 'zustand'; -import { persist, subscribeWithSelector } from 'zustand/middleware'; +import { persist } from 'zustand/middleware'; export const PositionsContainer = ({ onMarketClick, @@ -62,7 +62,7 @@ const usePositionsStore = create<{ update: (gridStore: Store) => void; }>()( persist( - subscribeWithSelector((set) => ({ + (set) => ({ gridStore: {}, update: (newStore) => { set((curr) => ({ @@ -72,7 +72,7 @@ const usePositionsStore = create<{ }, })); }, - })), + }), { name: 'vega_positions_store', }