Skip to content

Commit

Permalink
add the use version of settingskeyatom
Browse files Browse the repository at this point in the history
  • Loading branch information
sawka committed Oct 19, 2024
1 parent 3c94669 commit 613a583
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions frontend/app/store/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ function getSettingsKeyAtom<T extends keyof SettingsType>(key: T): Atom<Settings
return settingsKeyAtom;
}

function useSettingsKeyAtom<T extends keyof SettingsType>(key: T): SettingsType[T] {
return useAtomValue(getSettingsKeyAtom(key));
}

function useSettingsPrefixAtom(prefix: string): Atom<SettingsType> {
// TODO: use a shallow equal here to make this more efficient
let settingsPrefixAtom = settingsAtomCache.get(prefix + ":") as Atom<SettingsType>;
Expand Down Expand Up @@ -607,6 +611,7 @@ export {
useBlockDataLoaded,
useBlockMetaKeyAtom,
useOverrideConfigAtom,
useSettingsKeyAtom,
useSettingsPrefixAtom,
WOS,
};

0 comments on commit 613a583

Please sign in to comment.