@genesislcap/foundation-utils 14.496.1 → 14.496.2-alpha-438fb6e.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.
@@ -70,6 +70,17 @@ export declare const LifecycleMixin: <T extends ConstructableLifecycleHandler>(B
70
70
  * @internal
71
71
  **/
72
72
  #_shouldForceLifecycle: boolean;
73
+ /**
74
+ * Set once a microtask has elapsed since a blocked ('reflow') disconnect. A blocked disconnect
75
+ * promises the consumer "you'll reconnect imminently, don't tear anything down" - but some
76
+ * consumers (e.g. a grid wrapper) don't fully trust that promise and run their own defensive
77
+ * cleanup on a microtask if they're still disconnected by then, bypassing `shouldRunDisconnect`
78
+ * entirely. Once that window has passed we can no longer assume nothing was torn down, so the
79
+ * paired reconnect must not stay blocked either, or the consumer never gets a chance to
80
+ * re-initialize what it already destroyed.
81
+ * @internal
82
+ **/
83
+ #_blockedDisconnectSurvivedMicrotask: boolean;
73
84
  /**
74
85
  * @privateRemarks
75
86
  * Rather than using the basic implementation of cloning we run a copy constructor (deepClone)
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../../src/mixins/lifecycle/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAErE;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG,aAAa,CAAC,WAAW,GAAG,WAAW,CAAC,CAAC;AAErF;;;;GAIG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;IACxB,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,IAAI,EAAE,mBAAmB,CAAC;CAC3B,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,yBAAyB,CAAC;CACjC,CAAC;AAEF;;;GAGG;AACH,MAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAM1B,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,mBAAmB,eAAkC,CAAC"}
@@ -11,7 +11,7 @@ const CLEANUP_TIMEOUT_MS = 10000;
11
11
  * #_ syntax is used for a javascript private method/variable
12
12
  * we can't use private/protected from typescript in an anonymous class like this
13
13
  */
14
- export const LifecycleMixin = (Base) => { var _instances, __container, __latestTokenCode, __hasFirstLoaded, __cleanupTimeout, __shouldForceLifecycle, __blockLifecycleDueToTokenChange, __tryFindContainingLayout, _a; return _a = class extends Base {
14
+ export const LifecycleMixin = (Base) => { var _instances, __container, __latestTokenCode, __hasFirstLoaded, __cleanupTimeout, __shouldForceLifecycle, __blockedDisconnectSurvivedMicrotask, __blockLifecycleDueToTokenChange, __tryFindContainingLayout, _a; return _a = class extends Base {
15
15
  constructor(...args) {
16
16
  super(args);
17
17
  _instances.add(this);
@@ -42,6 +42,17 @@ export const LifecycleMixin = (Base) => { var _instances, __container, __latestT
42
42
  * @internal
43
43
  **/
44
44
  __shouldForceLifecycle.set(this, false);
45
+ /**
46
+ * Set once a microtask has elapsed since a blocked ('reflow') disconnect. A blocked disconnect
47
+ * promises the consumer "you'll reconnect imminently, don't tear anything down" - but some
48
+ * consumers (e.g. a grid wrapper) don't fully trust that promise and run their own defensive
49
+ * cleanup on a microtask if they're still disconnected by then, bypassing `shouldRunDisconnect`
50
+ * entirely. Once that window has passed we can no longer assume nothing was torn down, so the
51
+ * paired reconnect must not stay blocked either, or the consumer never gets a chance to
52
+ * re-initialize what it already destroyed.
53
+ * @internal
54
+ **/
55
+ __blockedDisconnectSurvivedMicrotask.set(this, false);
45
56
  }
46
57
  /**
47
58
  * @privateRemarks
@@ -127,6 +138,7 @@ export const LifecycleMixin = (Base) => { var _instances, __container, __latestT
127
138
  __hasFirstLoaded = new WeakMap(),
128
139
  __cleanupTimeout = new WeakMap(),
129
140
  __shouldForceLifecycle = new WeakMap(),
141
+ __blockedDisconnectSurvivedMicrotask = new WeakMap(),
130
142
  _instances = new WeakSet(),
131
143
  __blockLifecycleDueToTokenChange = function __blockLifecycleDueToTokenChange(lifecycleType) {
132
144
  var _b, _c;
@@ -146,6 +158,14 @@ export const LifecycleMixin = (Base) => { var _instances, __container, __latestT
146
158
  // 'reconnect' - otherwise unrelated layout changes while disconnected can block it forever.
147
159
  __classPrivateFieldSet(this, __hasFirstLoaded, false, "f");
148
160
  }
161
+ else {
162
+ // Blocked disconnect: track whether a microtask elapses before the paired reconnect
163
+ // arrives. See `#_blockedDisconnectSurvivedMicrotask` for why this matters.
164
+ __classPrivateFieldSet(this, __blockedDisconnectSurvivedMicrotask, false, "f");
165
+ queueMicrotask(() => {
166
+ __classPrivateFieldSet(this, __blockedDisconnectSurvivedMicrotask, true, "f");
167
+ });
168
+ }
149
169
  __classPrivateFieldSet(this, __cleanupTimeout, setTimeout(() => {
150
170
  __classPrivateFieldSet(this, __shouldForceLifecycle, result, "f");
151
171
  if (__classPrivateFieldGet(this, __shouldForceLifecycle, "f")) {
@@ -154,7 +174,7 @@ export const LifecycleMixin = (Base) => { var _instances, __container, __latestT
154
174
  }, CLEANUP_TIMEOUT_MS), "f");
155
175
  }
156
176
  else if (lifecycleType === 'reconnect') {
157
- result = tokensDifferent;
177
+ result = tokensDifferent && !__classPrivateFieldGet(this, __blockedDisconnectSurvivedMicrotask, "f");
158
178
  __classPrivateFieldSet(this, __latestTokenCode, (_c = __classPrivateFieldGet(this, __container, "f").lifecycleUpdateToken) !== null && _c !== void 0 ? _c : '', "f");
159
179
  clearTimeout(__classPrivateFieldGet(this, __cleanupTimeout, "f"));
160
180
  }
@@ -9094,7 +9094,7 @@
9094
9094
  },
9095
9095
  {
9096
9096
  "kind": "Content",
9097
- "text": ";\n #_shouldForceLifecycle: boolean;\n cloneNode(deep?: boolean): "
9097
+ "text": ";\n #_shouldForceLifecycle: boolean;\n #_blockedDisconnectSurvivedMicrotask: boolean;\n cloneNode(deep?: boolean): "
9098
9098
  },
9099
9099
  {
9100
9100
  "kind": "Reference",
@@ -1018,6 +1018,17 @@ export declare const LifecycleMixin: <T extends ConstructableLifecycleHandler>(B
1018
1018
  * @internal
1019
1019
  **/
1020
1020
  #_shouldForceLifecycle: boolean;
1021
+ /**
1022
+ * Set once a microtask has elapsed since a blocked ('reflow') disconnect. A blocked disconnect
1023
+ * promises the consumer "you'll reconnect imminently, don't tear anything down" - but some
1024
+ * consumers (e.g. a grid wrapper) don't fully trust that promise and run their own defensive
1025
+ * cleanup on a microtask if they're still disconnected by then, bypassing `shouldRunDisconnect`
1026
+ * entirely. Once that window has passed we can no longer assume nothing was torn down, so the
1027
+ * paired reconnect must not stay blocked either, or the consumer never gets a chance to
1028
+ * re-initialize what it already destroyed.
1029
+ * @internal
1030
+ **/
1031
+ #_blockedDisconnectSurvivedMicrotask: boolean;
1021
1032
  /**
1022
1033
  * @privateRemarks
1023
1034
  * Rather than using the basic implementation of cloning we run a copy constructor (deepClone)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-utils",
3
3
  "description": "Genesis Foundation Utils",
4
- "version": "14.496.1",
4
+ "version": "14.496.2-alpha-438fb6e.0",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -29,18 +29,18 @@
29
29
  }
30
30
  },
31
31
  "devDependencies": {
32
- "@genesislcap/foundation-testing": "14.496.1",
33
- "@genesislcap/genx": "14.496.1",
34
- "@genesislcap/rollup-builder": "14.496.1",
35
- "@genesislcap/ts-builder": "14.496.1",
36
- "@genesislcap/uvu-playwright-builder": "14.496.1",
37
- "@genesislcap/vite-builder": "14.496.1",
38
- "@genesislcap/webpack-builder": "14.496.1",
32
+ "@genesislcap/foundation-testing": "14.496.2-alpha-438fb6e.0",
33
+ "@genesislcap/genx": "14.496.2-alpha-438fb6e.0",
34
+ "@genesislcap/rollup-builder": "14.496.2-alpha-438fb6e.0",
35
+ "@genesislcap/ts-builder": "14.496.2-alpha-438fb6e.0",
36
+ "@genesislcap/uvu-playwright-builder": "14.496.2-alpha-438fb6e.0",
37
+ "@genesislcap/vite-builder": "14.496.2-alpha-438fb6e.0",
38
+ "@genesislcap/webpack-builder": "14.496.2-alpha-438fb6e.0",
39
39
  "@types/json-schema": "^7.0.11"
40
40
  },
41
41
  "dependencies": {
42
- "@genesislcap/expression-builder": "14.496.1",
43
- "@genesislcap/foundation-logger": "14.496.1",
42
+ "@genesislcap/expression-builder": "14.496.2-alpha-438fb6e.0",
43
+ "@genesislcap/foundation-logger": "14.496.2-alpha-438fb6e.0",
44
44
  "@microsoft/fast-components": "2.30.6",
45
45
  "@microsoft/fast-element": "1.14.0",
46
46
  "@microsoft/fast-foundation": "2.50.0",
@@ -58,5 +58,5 @@
58
58
  "access": "public"
59
59
  },
60
60
  "customElements": "dist/custom-elements.json",
61
- "gitHead": "e67ef49c0ef1f81ceeecb9725b06f4b43cda9a95"
61
+ "gitHead": "6dc7bbda02ba69207921891ffbd1f39b582ac780"
62
62
  }