@lukekaalim/act-backstage 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/package.json +3 -3
  3. package/space.ts +20 -5
package/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # @lukekaalim/act-backstage
2
+
3
+ ## 1.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 4381035: Added error boundaries
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [4381035]
12
+ - @lukekaalim/act-recon@1.1.0
13
+ - @lukekaalim/act@3.1.0
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@lukekaalim/act-backstage",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "main": "mod.ts",
5
5
  "dependencies": {
6
- "@lukekaalim/act": "^3.0.0",
7
- "@lukekaalim/act-recon": "^1.0.0"
6
+ "@lukekaalim/act": "^3.1.0",
7
+ "@lukekaalim/act-recon": "^1.1.0"
8
8
  }
9
9
  }
package/space.ts CHANGED
@@ -59,7 +59,7 @@ export const createSimpleRenderSpace = <T, R extends string | Symbol>(
59
59
  if (node && !ignoreFirst)
60
60
  return [node];
61
61
  const commit = tree.commits.get(id);
62
- if (!commit)
62
+ if (!commit || commit.suspended)
63
63
  return [];
64
64
  if (commit.element.type === act.primitiveNodeTypes.null)
65
65
  return [];
@@ -97,7 +97,7 @@ export const createSimpleRenderSpace = <T, R extends string | Symbol>(
97
97
  const needsReorder = new Set<recon.CommitID>();
98
98
 
99
99
  for (const delta of deltas.created) {
100
- if (delta.next.element.type === act.primitiveNodeTypes.render) {
100
+ if (delta.next.element.type === act.renderNodeType) {
101
101
  // add render boundary
102
102
  rootIds.add(delta.ref.id);
103
103
  continue;
@@ -143,8 +143,24 @@ export const createSimpleRenderSpace = <T, R extends string | Symbol>(
143
143
  if (args.update) {
144
144
  for (const delta of deltas.updated) {
145
145
  const node = nodeByCommit.get(delta.ref.id);
146
- if (node)
147
- args.update(node, delta.next.element, delta.prev.element);
146
+ if (!node)
147
+ continue;
148
+ args.update(node, delta.next.element, delta.prev.element);
149
+
150
+ if (delta.prev.suspended !== delta.next.suspended) {
151
+ const parent = findParent(delta.ref);
152
+ const parentNode = parent && parent.node;
153
+ if (parentNode) {
154
+ needsReorder.add(parent.id)
155
+ }
156
+ console.log('altering suspention type', node, parentNode, delta.next)
157
+ if (!parent || parentNode) {
158
+ if (!delta.next.suspended && args.link)
159
+ args.link(node, parentNode);
160
+ if (delta.next.suspended && args.unlink)
161
+ args.unlink(node, parentNode);
162
+ }
163
+ }
148
164
  }
149
165
  for (const delta of deltas.created) {
150
166
  const node = nodeByCommit.get(delta.ref.id);
@@ -152,7 +168,6 @@ export const createSimpleRenderSpace = <T, R extends string | Symbol>(
152
168
  args.update(node, delta.next.element, null);
153
169
  }
154
170
  }
155
-
156
171
  for (const delta of deltas.removed) {
157
172
  const prevResult = nodeByCommit.get(delta.ref.id);
158
173
  if (prevResult) {