MCPcopy
hub / github.com/wavetermdev/waveterm / useAtomValueSafe

Function useAtomValueSafe

frontend/util/util.ts:238–243  ·  view source on GitHub ↗
(atom: Atom<T> | Atom<Promise<T>>)

Source from the content-addressed store, hash-verified

236const NullAtom = atom(null);
237
238function useAtomValueSafe<T>(atom: Atom<T> | Atom<Promise<T>>): T {
239 if (atom == null) {
240 return useAtomValue(NullAtom) as T;
241 }
242 return useAtomValue(atom);
243}
244
245/**
246 * Simple wrapper function that lazily evaluates the provided function and caches its result for future calls.

Callers 7

MarkdownFunction · 0.90
CodeBlockFunction · 0.90
TerminalViewFunction · 0.90
webview.tsxFile · 0.90
WorkspaceSwitcherItemFunction · 0.90
block.tsxFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected