MCPcopy
hub / github.com/riot/riot / update

Function update

riot+compiler.js:23983–24012  ·  view source on GitHub ↗
(scope, parentScope)

Source from the content-addressed store, hash-verified

23981 return this.update(scope, parentScope)
23982 },
23983 update(scope, parentScope) {
23984 const { placeholder, nodes, childrenMap } = this;
23985 const collection = scope === UNMOUNT_SCOPE ? null : this.evaluate(scope);
23986 const items = collection ? Array.from(collection) : [];
23987
23988 // prepare the diffing
23989 const { newChildrenMap, batches, futureNodes } = createPatch(
23990 items,
23991 scope,
23992 parentScope,
23993 this,
23994 );
23995
23996 // patch the DOM only if there are new nodes
23997 udomdiff(
23998 nodes,
23999 futureNodes,
24000 patch(Array.from(childrenMap.values()), parentScope),
24001 placeholder,
24002 );
24003
24004 // trigger the mounts and the updates
24005 batches.forEach((fn) => fn());
24006
24007 // update the children map
24008 this.childrenMap = newChildrenMap;
24009 this.nodes = futureNodes;
24010
24011 return this
24012 },
24013 unmount(scope, parentScope) {
24014 this.update(UNMOUNT_SCOPE, parentScope);
24015

Callers

nothing calls this directly

Calls 13

createPatchFunction · 0.70
udomdiffFunction · 0.70
patchFunction · 0.70
mountFunction · 0.70
getRealParentFunction · 0.70
getTagFunction · 0.70
DOMattributesToObjectFunction · 0.70
definePropertyFunction · 0.70
computeComponentStateFunction · 0.70
unmountMethod · 0.65
updateMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…