Skip to content

Commit

Permalink
Fix default theme and store (#575)
Browse files Browse the repository at this point in the history
  • Loading branch information
fzaninotto authored Jul 31, 2024
1 parent cd704b4 commit 5b67925
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/core/AdminGuesser.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import React, { useEffect, useMemo, useState } from 'react';
import { AdminContext, defaultI18nProvider } from 'react-admin';
import {
AdminContext,
defaultI18nProvider,
/* tree-shaking no-side-effects-when-called */ localStorageStore,
} from 'react-admin';

import type { ComponentType } from 'react';
import type { AdminProps } from 'react-admin';
Expand All @@ -12,8 +16,8 @@ import {
Error as DefaultError,
Layout,
LoginPage,
darkTheme,
lightTheme,
darkTheme as defaultDarkTheme,
lightTheme as defaultLightTheme,
} from '../layout/index.js';
import type { ApiPlatformAdminDataProvider, SchemaAnalyzer } from '../types.js';

Expand All @@ -24,6 +28,8 @@ export interface AdminGuesserProps extends AdminProps {
includeDeprecated?: boolean;
}

const defaultStore = localStorageStore();

const AdminGuesser = ({
// Props for SchemaAnalyzerContext
schemaAnalyzer,
Expand All @@ -33,7 +39,7 @@ const AdminGuesser = ({
basename,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
error = DefaultError as any,
store,
store = defaultStore,
dataProvider,
i18nProvider = defaultI18nProvider,
authProvider,
Expand All @@ -42,7 +48,8 @@ const AdminGuesser = ({
layout = Layout,
loginPage = LoginPage,
loading: loadingPage,
theme = lightTheme,
theme = defaultLightTheme,
darkTheme = defaultDarkTheme,
// Other props
children,
...rest
Expand Down Expand Up @@ -98,7 +105,6 @@ const AdminGuesser = ({
queryClient={queryClient}
theme={theme}
darkTheme={darkTheme}
lightTheme={lightTheme}
defaultTheme={defaultTheme}>
<IntrospectionContext.Provider value={introspectionContext}>
<SchemaAnalyzerContext.Provider value={schemaAnalyzer}>
Expand Down
3 changes: 3 additions & 0 deletions src/layout/themes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ export const darkTheme: RaThemeOptions = {
},
},
},
MuiFilledInput: {
styleOverrides: undefined,
},
},
};

Expand Down

0 comments on commit 5b67925

Please sign in to comment.