From e2717441e33a909e31d0470d97dc4e5701bad406 Mon Sep 17 00:00:00 2001 From: Usame Algan Date: Tue, 6 Feb 2024 18:58:41 +0100 Subject: [PATCH] refactor: Rename redux slice --- ...loyedSafeSlice.ts => undeployedSafesSlice.ts} | 16 ++++++++-------- src/features/counterfactual/utils.ts | 2 +- src/hooks/coreSDK/useInitSafeCoreSDK.ts | 2 +- src/hooks/loadables/useLoadSafeInfo.ts | 2 +- src/store/index.ts | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) rename src/features/counterfactual/store/{undeployedSafeSlice.ts => undeployedSafesSlice.ts} (78%) diff --git a/src/features/counterfactual/store/undeployedSafeSlice.ts b/src/features/counterfactual/store/undeployedSafesSlice.ts similarity index 78% rename from src/features/counterfactual/store/undeployedSafeSlice.ts rename to src/features/counterfactual/store/undeployedSafesSlice.ts index 3f9108d32d..5d17fbf4ca 100644 --- a/src/features/counterfactual/store/undeployedSafeSlice.ts +++ b/src/features/counterfactual/store/undeployedSafesSlice.ts @@ -2,14 +2,14 @@ import { type RootState } from '@/store' import { createSelector, createSlice, type PayloadAction } from '@reduxjs/toolkit' import type { PredictedSafeProps } from '@safe-global/protocol-kit' -type UndeployedSafeSlice = { [address: string]: PredictedSafeProps } +type UndeployedSafesSlice = { [address: string]: PredictedSafeProps } -type UndeployedSafeState = { [chainId: string]: UndeployedSafeSlice } +type UndeployedSafesState = { [chainId: string]: UndeployedSafesSlice } -const initialState: UndeployedSafeState = {} +const initialState: UndeployedSafesState = {} -export const undeployedSafeSlice = createSlice({ - name: 'undeployedSafe', +export const undeployedSafesSlice = createSlice({ + name: 'undeployedSafes', initialState, reducers: { addUndeployedSafe: ( @@ -38,10 +38,10 @@ export const undeployedSafeSlice = createSlice({ }, }) -export const { removeUndeployedSafe, addUndeployedSafe } = undeployedSafeSlice.actions +export const { removeUndeployedSafe, addUndeployedSafe } = undeployedSafesSlice.actions -export const selectUndeployedSafes = (state: RootState): UndeployedSafeState => { - return state[undeployedSafeSlice.name] +export const selectUndeployedSafes = (state: RootState): UndeployedSafesState => { + return state[undeployedSafesSlice.name] } export const selectUndeployedSafe = createSelector( diff --git a/src/features/counterfactual/utils.ts b/src/features/counterfactual/utils.ts index b5f60e4cdb..b58954338e 100644 --- a/src/features/counterfactual/utils.ts +++ b/src/features/counterfactual/utils.ts @@ -1,7 +1,7 @@ import type { NewSafeFormData } from '@/components/new-safe/create' import { LATEST_SAFE_VERSION } from '@/config/constants' import { AppRoutes } from '@/config/routes' -import { addUndeployedSafe } from '@/features/counterfactual/store/undeployedSafeSlice' +import { addUndeployedSafe } from '@/features/counterfactual/store/undeployedSafesSlice' import type { AppDispatch } from '@/store' import { addOrUpdateSafe } from '@/store/addedSafesSlice' import { upsertAddressBookEntry } from '@/store/addressBookSlice' diff --git a/src/hooks/coreSDK/useInitSafeCoreSDK.ts b/src/hooks/coreSDK/useInitSafeCoreSDK.ts index 383656d4ae..012502131e 100644 --- a/src/hooks/coreSDK/useInitSafeCoreSDK.ts +++ b/src/hooks/coreSDK/useInitSafeCoreSDK.ts @@ -1,4 +1,4 @@ -import { selectUndeployedSafe } from '@/features/counterfactual/store/undeployedSafeSlice' +import { selectUndeployedSafe } from '@/features/counterfactual/store/undeployedSafesSlice' import { useEffect } from 'react' import { useRouter } from 'next/router' import useSafeInfo from '@/hooks/useSafeInfo' diff --git a/src/hooks/loadables/useLoadSafeInfo.ts b/src/hooks/loadables/useLoadSafeInfo.ts index 9cfd74a0d6..96ae19e4ac 100644 --- a/src/hooks/loadables/useLoadSafeInfo.ts +++ b/src/hooks/loadables/useLoadSafeInfo.ts @@ -1,4 +1,4 @@ -import { selectUndeployedSafe } from '@/features/counterfactual/store/undeployedSafeSlice' +import { selectUndeployedSafe } from '@/features/counterfactual/store/undeployedSafesSlice' import { getUndeployedSafeInfo } from '@/features/counterfactual/utils' import { useAppSelector } from '@/store' import { useEffect } from 'react' diff --git a/src/store/index.ts b/src/store/index.ts index 77f0b4e4bf..8258a6d6ba 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -29,7 +29,7 @@ import { safeAppsSlice } from './safeAppsSlice' import { safeMessagesListener, safeMessagesSlice } from './safeMessagesSlice' import { pendingSafeMessagesSlice } from './pendingSafeMessagesSlice' import { batchSlice } from './batchSlice' -import { undeployedSafeSlice } from '@/features/counterfactual/store/undeployedSafeSlice' +import { undeployedSafesSlice } from '@/features/counterfactual/store/undeployedSafesSlice' const rootReducer = combineReducers({ [chainsSlice.name]: chainsSlice.reducer, @@ -50,7 +50,7 @@ const rootReducer = combineReducers({ [safeMessagesSlice.name]: safeMessagesSlice.reducer, [pendingSafeMessagesSlice.name]: pendingSafeMessagesSlice.reducer, [batchSlice.name]: batchSlice.reducer, - [undeployedSafeSlice.name]: undeployedSafeSlice.reducer, + [undeployedSafesSlice.name]: undeployedSafesSlice.reducer, }) const persistedSlices: (keyof PreloadedState)[] = [ @@ -63,7 +63,7 @@ const persistedSlices: (keyof PreloadedState)[] = [ safeAppsSlice.name, pendingSafeMessagesSlice.name, batchSlice.name, - undeployedSafeSlice.name, + undeployedSafesSlice.name, ] export const getPersistedState = () => {