MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / executeCompositeRender

Function executeCompositeRender

packages/core/src/runtime/commit/composite.ts:69–275  ·  view source on GitHub ↗
(
  instanceId: InstanceId,
  vnode: VNode,
  compositeMeta: CompositeWidgetMeta,
  ctx: CommitCtx,
  nodePath: string[],
  depth: number,
  commitContainer: CommitContainerFn,
)

Source from the content-addressed store, hash-verified

67}
68
69export function executeCompositeRender(
70 instanceId: InstanceId,
71 vnode: VNode,
72 compositeMeta: CompositeWidgetMeta,
73 ctx: CommitCtx,
74 nodePath: string[],
75 depth: number,
76 commitContainer: CommitContainerFn,
77): CommitNodeResult {
78 const prev =
79 ctx.prevNodeStack.length > 0 ? (ctx.prevNodeStack[ctx.prevNodeStack.length - 1] ?? null) : null;
80 const compositeRuntime = ctx.composite as NonNullable<CommitCtx["composite"]>;
81
82 let compositeChild: VNode | null = null;
83 let popCompositeStack = false;
84 try {
85 const activeCompositeMeta = compositeMeta;
86 const registry = compositeRuntime.registry;
87 const existing = registry.get(instanceId);
88
89 if (existing && existing.widgetKey !== compositeMeta.widgetKey) {
90 registry.incrementGeneration(instanceId);
91 registry.delete(instanceId);
92 }
93
94 if (!registry.get(instanceId)) {
95 try {
96 registry.create(instanceId, compositeMeta.widgetKey);
97 } catch (e: unknown) {
98 return {
99 ok: false,
100 fatal: {
101 code: "ZRUI_USER_CODE_THROW",
102 detail: describeThrown(e),
103 },
104 };
105 }
106 }
107
108 const state = registry.get(instanceId);
109 if (!state) {
110 return {
111 ok: false,
112 fatal: {
113 code: "ZRUI_INVALID_PROPS",
114 detail: `composite state missing for instanceId=${String(instanceId)}`,
115 },
116 };
117 }
118
119 const invalidateInstance = () => {
120 registry.invalidate(instanceId);
121 ctx.composite?.onInvalidate(instanceId);
122 };
123
124 const prevMeta = prev ? getCompositeMeta(prev.vnode) : null;
125 const prevChild = prev?.children[0] ?? null;
126 const previousSelections = registry.getAppStateSelections(instanceId);

Callers 1

commitNodeFunction · 0.85

Calls 14

getCompositeMetaFunction · 0.85
compositePropsEqualFunction · 0.85
readCompositeColorTokensFunction · 0.85
createHookContextFunction · 0.85
scopedIdFunction · 0.85
isContainerVNodeFunction · 0.85
commitContainerFunction · 0.85
createMethod · 0.80
describeThrownFunction · 0.50
getMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected