diff --git a/optuna_dashboard/ts/components/GraphEdf.tsx b/optuna_dashboard/ts/components/GraphEdf.tsx
index d067f8f3..7211176d 100644
--- a/optuna_dashboard/ts/components/GraphEdf.tsx
+++ b/optuna_dashboard/ts/components/GraphEdf.tsx
@@ -11,11 +11,12 @@ export const GraphEdf: FC<{
studies: StudyDetail[]
objectiveId: number
}> = ({ studies, objectiveId }) => {
+ const theme = useTheme()
+ const colorTheme = usePlotlyColorTheme(theme.palette.mode)
+
if (useBackendRender()) {
return
} else {
- const theme = useTheme()
- const colorTheme = usePlotlyColorTheme(theme.palette.mode)
return (
)
} else {
- const theme = useTheme()
- const colorTheme = usePlotlyColorTheme(theme.palette.mode)
return (
diff --git a/optuna_dashboard/ts/components/GraphSlice.tsx b/optuna_dashboard/ts/components/GraphSlice.tsx
index 4c67d8ff..8f75b1ae 100644
--- a/optuna_dashboard/ts/components/GraphSlice.tsx
+++ b/optuna_dashboard/ts/components/GraphSlice.tsx
@@ -14,11 +14,12 @@ import { useBackendRender, usePlotlyColorTheme } from "../state"
export const GraphSlice: FC<{
study: StudyDetail | null
}> = ({ study = null }) => {
+ const theme = useTheme()
+ const colorTheme = usePlotlyColorTheme(theme.palette.mode)
+
if (useBackendRender()) {
return
} else {
- const theme = useTheme()
- const colorTheme = usePlotlyColorTheme(theme.palette.mode)
return
}
}