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

Function getBlockMetaKeyAtom

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

Source from the content-addressed store, hash-verified

117}
118
119function getBlockMetaKeyAtom<T extends keyof MetaType>(blockId: string, key: T): Atom<MetaType[T]> {
120 const blockCache = getSingleBlockAtomCache(blockId);
121 const metaAtomName = "#meta-" + key;
122 let metaAtom = blockCache.get(metaAtomName);
123 if (metaAtom != null) {
124 return metaAtom;
125 }
126 metaAtom = atom((get) => {
127 const blockAtom = WOS.getWaveObjectAtom(WOS.makeORef("block", blockId));
128 const blockData = get(blockAtom);
129 return blockData?.meta?.[key];
130 });
131 blockCache.set(metaAtomName, metaAtom);
132 return metaAtom;
133}
134
135function getTabMetaKeyAtom<T extends keyof MetaType>(tabId: string, key: T): Atom<MetaType[T]> {
136 return getOrefMetaKeyAtom(WOS.makeORef("tab", tabId), key);

Callers 5

constructorMethod · 0.90
getSettingsMenuItemsMethod · 0.90
constructorMethod · 0.90
getOverrideConfigAtomFunction · 0.85

Calls 3

getSingleBlockAtomCacheFunction · 0.85
getMethod · 0.80
setMethod · 0.80

Tested by

no test coverage detected