mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-03-02 04:02:13 +01:00
add the use version of settingskeyatom
This commit is contained in:
parent
3c94669d93
commit
613a583513
@ -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 New Issue
Block a user