mirror of
https://github.com/wavetermdev/waveterm
synced 2026-05-23 08:48:28 +00:00
add the use version of settingskeyatom
This commit is contained in:
parent
3c94669d93
commit
613a583513
1 changed files with 5 additions and 0 deletions
|
|
@ -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>;
|
||||
|
|
@ -607,6 +611,7 @@ export {
|
|||
useBlockDataLoaded,
|
||||
useBlockMetaKeyAtom,
|
||||
useOverrideConfigAtom,
|
||||
useSettingsKeyAtom,
|
||||
useSettingsPrefixAtom,
|
||||
WOS,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue