MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / getOverrideConfigAtom

Function getOverrideConfigAtom

frontend/app/store/global.ts:177–207  ·  view source on GitHub ↗
(blockId: string, key: T)

Source from the content-addressed store, hash-verified

175const settingsAtomCache = new Map<string, Atom<any>>();
176
177function getOverrideConfigAtom<T extends keyof SettingsType>(blockId: string, key: T): Atom<SettingsType[T]> {
178 if (isPreviewWindow()) return NullAtom as Atom<SettingsType[T]>;
179 const blockCache = getSingleBlockAtomCache(blockId);
180 const overrideAtomName = "#settingsoverride-" + key;
181 let overrideAtom = blockCache.get(overrideAtomName);
182 if (overrideAtom != null) {
183 return overrideAtom;
184 }
185 overrideAtom = atom((get) => {
186 const blockMetaKeyAtom = getBlockMetaKeyAtom(blockId, key as any);
187 const metaKeyVal = get(blockMetaKeyAtom);
188 if (metaKeyVal != null) {
189 return metaKeyVal;
190 }
191 const connNameAtom = getBlockMetaKeyAtom(blockId, "connection");
192 const connName = get(connNameAtom);
193 const connConfigKeyAtom = getConnConfigKeyAtom(connName, key as any);
194 const connConfigKeyVal = get(connConfigKeyAtom);
195 if (connConfigKeyVal != null) {
196 return connConfigKeyVal;
197 }
198 const settingsKeyAtom = getSettingsKeyAtom(key);
199 const settingsVal = get(settingsKeyAtom);
200 if (settingsVal != null) {
201 return settingsVal;
202 }
203 return null;
204 });
205 blockCache.set(overrideAtomName, overrideAtom);
206 return overrideAtom;
207}
208
209function useOverrideConfigAtom<T extends keyof SettingsType>(blockId: string | null, key: T): SettingsType[T] {
210 if (blockId == null) {

Callers 9

constructorMethod · 0.90
handleOsc52CommandFunction · 0.90
TerminalViewFunction · 0.90
constructorMethod · 0.90
handleTerminalKeydownMethod · 0.90
MarkdownPreviewFunction · 0.90
getSettingsMenuItemsMethod · 0.90
useOverrideConfigAtomFunction · 0.85
getBlockTermDurableAtomFunction · 0.85

Calls 7

isPreviewWindowFunction · 0.90
getSingleBlockAtomCacheFunction · 0.85
getBlockMetaKeyAtomFunction · 0.85
getConnConfigKeyAtomFunction · 0.85
getSettingsKeyAtomFunction · 0.85
getMethod · 0.80
setMethod · 0.80

Tested by

no test coverage detected