MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / patchElements

Function patchElements

packages/studio/src/components/nle/NLELayout.tsx:317–331  ·  view source on GitHub ↗
(elements: TimelineElement[])

Source from the content-addressed store, hash-verified

315 useEffect(() => {
316 if (compIdToSrc.size === 0) return;
317 const patchElements = (elements: TimelineElement[]): TimelineElement[] | null => {
318 const map = compIdToSrcRef.current;
319 if (map.size === 0) return null;
320 let patched = false;
321 const updated = elements.map((el) => {
322 if (el.compositionSrc) return el;
323 const src = map.get(el.id) ?? map.get(el.id.replace(/-(host|comp|layer)$/, ""));
324 if (src) {
325 patched = true;
326 return { ...el, compositionSrc: src };
327 }
328 return el;
329 });
330 return patched ? updated : null;
331 };
332 const patched = patchElements(usePlayerStore.getState().elements);
333 if (patched) usePlayerStore.getState().setElements(patched);
334 let patching = false;

Callers 1

NLELayout.tsxFile · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected