diff --git a/apps/client/src/widgets/react/hooks.tsx b/apps/client/src/widgets/react/hooks.tsx index 5fe9ed883..38f0a1967 100644 --- a/apps/client/src/widgets/react/hooks.tsx +++ b/apps/client/src/widgets/react/hooks.tsx @@ -201,7 +201,7 @@ export function useTriliumOptionBool(name: OptionNames, needsRefresh?: boolean): return [ (value === "true"), (newValue) => setValue(newValue ? "true" : "false") - ] + ]; } /** @@ -217,17 +217,18 @@ export function useTriliumOptionInt(name: OptionNames): [number, (newValue: numb return [ (parseInt(value, 10)), (newValue) => setValue(newValue) - ] + ]; } /** * Similar to {@link useTriliumOption}, but the object value is parsed to and from a JSON instead of a string. * * @param name the name of the option to listen for. + * @param needsRefresh whether to reload the frontend whenever the value is changed. * @returns an array where the first value is the current option value and the second value is the setter. */ -export function useTriliumOptionJson(name: OptionNames): [ T, (newValue: T) => Promise ] { - const [ value, setValue ] = useTriliumOption(name); +export function useTriliumOptionJson(name: OptionNames, needsRefresh?: boolean): [ T, (newValue: T) => Promise ] { + const [ value, setValue ] = useTriliumOption(name, needsRefresh); useDebugValue(name); return [ (JSON.parse(value) as T), diff --git a/apps/client/src/widgets/type_widgets/options/advanced.tsx b/apps/client/src/widgets/type_widgets/options/advanced.tsx index 958180063..4024a9d0e 100644 --- a/apps/client/src/widgets/type_widgets/options/advanced.tsx +++ b/apps/client/src/widgets/type_widgets/options/advanced.tsx @@ -158,7 +158,7 @@ function ExistingAnonymizedDatabases({ databases }: { databases: AnonymizedDbRes ))} - ) + ); } function VacuumDatabaseOptions() { @@ -175,11 +175,11 @@ function VacuumDatabaseOptions() { }} /> - ) + ); } function ExperimentalOptions() { - const [ enabledExperimentalFeatures, setEnabledExperimentalFeatures ] = useTriliumOptionJson("experimentalFeatures"); + const [ enabledExperimentalFeatures, setEnabledExperimentalFeatures ] = useTriliumOptionJson("experimentalFeatures", true); return (