chore: remove unnecessary usage of subscribeWithSelector

This commit is contained in:
Matthew Russell
2023-06-26 14:20:36 -07:00
parent ccd0007e36
commit 5fa7078833
5 changed files with 15 additions and 17 deletions
@@ -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',
}
@@ -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',
}
@@ -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',
}
@@ -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',
}
@@ -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',
}