Skip to content

Commit

Permalink
fix: UI was reloading everytime the token is refreshed because the re…
Browse files Browse the repository at this point in the history
…dux store got re-initialized
  • Loading branch information
JBWatenbergScality committed Nov 10, 2023
1 parent 6e94142 commit 343fca2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/react/FederableApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ import MetricsAdapterProvider from './next-architecture/ui/MetricsAdapterProvide
import { LocationAdapterProvider } from './next-architecture/ui/LocationAdapterProvider';

import zenkoUIReducer from './reducers';
import { useMemo } from 'react';

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

const InternalRouter = ({ children }: { children: React.ReactNode }) => {
const config = useConfig();
const store = createStore(
zenkoUIReducer(),
composeEnhancers(applyMiddleware(thunk)),
const store = useMemo(
() =>
createStore(zenkoUIReducer(), composeEnhancers(applyMiddleware(thunk))),
[],
);

return (
Expand Down
2 changes: 1 addition & 1 deletion src/types/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import type { ManagementClient as ManagementClientInterface } from './management
import type { STSClient } from './sts';
import type { Workflows } from './workflow';
export type AuthState = {
readonly isConfigLoaded: string;
readonly isConfigLoaded: boolean;
readonly isClientsLoaded: boolean;
readonly configFailure: boolean;
readonly managementClient: ManagementClientInterface;
Expand Down

0 comments on commit 343fca2

Please sign in to comment.