mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-09 11:28:14 +08:00
Fix the bug that violates "Rules of Hooks"
This commit is contained in:
@@ -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 <GraphEdfBackend studies={studies} />
|
||||
} else {
|
||||
const theme = useTheme()
|
||||
const colorTheme = usePlotlyColorTheme(theme.palette.mode)
|
||||
return (
|
||||
<PlotEdf
|
||||
studies={studies}
|
||||
|
||||
@@ -23,6 +23,9 @@ export const GraphHyperparameterImportance: FC<{
|
||||
studyId,
|
||||
})
|
||||
|
||||
const theme = useTheme()
|
||||
const colorTheme = usePlotlyColorTheme(theme.palette.mode)
|
||||
|
||||
if (useBackendRender()) {
|
||||
return (
|
||||
<GraphHyperparameterImportanceBackend
|
||||
@@ -32,8 +35,6 @@ export const GraphHyperparameterImportance: FC<{
|
||||
/>
|
||||
)
|
||||
} else {
|
||||
const theme = useTheme()
|
||||
const colorTheme = usePlotlyColorTheme(theme.palette.mode)
|
||||
return (
|
||||
<Card>
|
||||
<CardContent>
|
||||
|
||||
@@ -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 <GraphSliceBackend study={study} />
|
||||
} else {
|
||||
const theme = useTheme()
|
||||
const colorTheme = usePlotlyColorTheme(theme.palette.mode)
|
||||
return <PlotSlice study={study} colorTheme={colorTheme} />
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user