MCPcopy
hub / github.com/toeverything/AFFiNE / useLiveData

Function useLiveData

packages/common/infra/src/livedata/react.ts:20–37  ·  view source on GitHub ↗
(
  liveData: Input
)

Source from the content-addressed store, hash-verified

18 * subscribe LiveData and return the value.
19 */
20export function useLiveData<Input extends LiveData<any> | null | undefined>(
21 liveData: Input
22): NonNullable<Input> extends LiveData<infer T>
23 ? Input extends undefined
24 ? T | undefined
25 : Input extends null
26 ? T | null
27 : T
28 : never {
29 return useSyncExternalStore(
30 liveData ? liveData.reactSubscribe : noopSubscribe,
31 liveData
32 ? liveData.reactGetSnapshot
33 : liveData === undefined
34 ? undefinedGetSnapshot
35 : nullGetSnapshot
36 );
37}

Callers 15

WebOpenInAppGuardFunction · 0.90
ValueRendererFunction · 0.90
workbench-root.tsxFile · 0.90
WorkbenchSidebarFunction · 0.90
RouteContainerFunction · 0.90
useIsActiveViewFunction · 0.90
workbench-link.tsxFile · 0.90
ViewRootFunction · 0.90
ViewSidebarTabFunction · 0.90
panel.tsxFile · 0.90

Calls

no outgoing calls

Tested by 2

ComponentFunction · 0.68
Component1Function · 0.68