Skip to content
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

fix: UI was reloading everytime the token is refreshed because the redux store got re-initialized #673

Merged
merged 1 commit into from
Nov 10, 2023
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
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
Loading