Skip to content

Commit

Permalink
fix: reset settings not working properly due to url encoding (#10000)
Browse files Browse the repository at this point in the history
  • Loading branch information
gt2345 authored Oct 1, 2024
1 parent 25ca6d0 commit 7f88390
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions webui/react/src/hooks/useSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const settingsToQuery = <T>(config: SettingsConfig<T>, settings: Settings) => {

if (qParams.toString().length !== 0) {
for (const param of qParams.keys()) {
if (settings[param] === undefined) {
if (!(param in settings)) {
// passing all non-setting param into the retval
retVal.append(param, qParams.get(param) as string);
}
Expand Down Expand Up @@ -248,13 +248,15 @@ const useSettings = <T>(config: SettingsConfig<T>): UseSettingsReturn<T> => {
});

userSettings.remove(config.storagePath);

const mappedSettings = settingsToQuery(config, news);
const url = mappedSettings ? `?${mappedSettings}` : '';
navigate(url, { replace: true });
return news;
});
});
});
},
[config, currentUser, rawState],
[config, currentUser, rawState, navigate],
);

const updateSettings = useCallback(
Expand Down

0 comments on commit 7f88390

Please sign in to comment.