Skip to content

fix: netlify build fail due to typescript bug fixed #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { HelmetProvider } from 'react-helmet-async';
import { StylesContext } from './context';
import routes from './routes/routes.tsx';
import { useSelector } from 'react-redux';

import { RootState } from './redux/store';
import './App.css';

// color palettes: triadic #A1A7CB, #CBA1A7, #A7CBA1
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { NProgress } from '../../components';
import { PATH_LANDING } from '../../constants';
import { useSelector, useDispatch } from 'react-redux';
import { toggleTheme } from '../../redux/theme/themeSlice.ts';

import { RootState } from '../../redux/store.ts';
const { Content } = Layout;

type AppLayoutProps = {
Expand Down
20 changes: 17 additions & 3 deletions src/redux/store.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,38 @@
import { configureStore, combineReducers } from '@reduxjs/toolkit';
import themeReducer from './theme/themeSlice';
import themeReducer, { ThemeState } from './theme/themeSlice';
import { persistReducer, persistStore, PersistConfig } from 'redux-persist';
import storage from 'redux-persist/lib/storage';

// Define the state shape
interface RootState {
theme: ThemeState;
}

// Combine reducers
const rootReducer = combineReducers({
theme: themeReducer,
});

const persistConfig: PersistConfig<any> = {
// Persist config with RootState
const persistConfig: PersistConfig<RootState> = {
key: 'root',
storage,
version: 1,
};

const persistedReducer = persistReducer(persistConfig, rootReducer);

// Configure store with persisted reducer
export const store = configureStore({
reducer: persistedReducer,
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware({ serializableCheck: false }),
getDefaultMiddleware({
serializableCheck: false,
}),
});

// Persistor
export const persistor = persistStore(store);

// Type for RootState
export type { RootState };
2 changes: 1 addition & 1 deletion src/redux/theme/themeSlice.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createSlice } from '@reduxjs/toolkit';

interface ThemeState {
export interface ThemeState {
mytheme: string;
}

Expand Down
Loading