@absolutejs/absolute 0.19.0-beta.873 → 0.19.0-beta.875

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.
@@ -14,23 +14,24 @@ import type {} from '../../../types/globals';
14
14
  * so it participates in the parent's view tree instead of being a
15
15
  * detached root.
16
16
  *
17
- * Caveats baked into this approach:
18
- * Old @Input bindings from the parent are NOT re-applied. The
19
- * parent's template flow runs at parent-CD time and wires inputs
20
- * then; until then the new instance sees default values. In
21
- * practice this matches Tier 1 rebootstrap behavior — no worse.
22
- * Old projection content (ng-content) doesn't transfer. If the
23
- * parent injected a child via ng-content, the new instance has an
24
- * empty projection slot until parent re-renders.
25
- * Class field initializers (e.g. `private foo = inject(Bar)`) are
26
- * baked into the original class's compiled constructor at bundle
27
- * time. The surgical update patches `Class.ɵcmp` and prototype
28
- * methods, but does NOT replace the class itself so a NEW field
29
- * added in source after the initial bundle won't appear on the
30
- * fresh instance. Method-body / decorator / provider / template
31
- * changes DO take effect (they live on the def, not the
32
- * constructor). To pick up new field initializers requires a
33
- * class-level rewrite or escalation to Tier 1b rebootstrap. */
17
+ * Lifecycle of one remount:
18
+ * 1. `applyMetadata` runs, returning `_Fresh` a class with the
19
+ * full new body (fields + ctor + methods) and a `ɵfac` that
20
+ * delegates to the LIVE class's factory with `_Fresh` as the
21
+ * type override. The delegation preserves the bundle's resolved
22
+ * DI for explicit constructor params.
23
+ * 2. For each live instance: `createComponent(_Fresh, hostElement)`
24
+ * builds a fresh `ComponentRef` at the same host. Angular runs
25
+ * the new constructor (firing field initializers + lifecycle
26
+ * hooks) and renders the new template.
27
+ * 3. Splice the new LView into the parent's slot via vendored slot
28
+ * ops, replacing the old one in the parent's view tree.
29
+ * 4. Tear down the old LView (`executeOnDestroys` +
30
+ * `processCleanups`) so RxJS subscriptions, DOM event listeners,
31
+ * and `inject(DestroyRef).onDestroy(...)` callbacks all fire.
32
+ * 5. `ApplicationRef.tick()` so the parent's template re-runs
33
+ * against the new slot re-applies `@Input` bindings and
34
+ * re-projects `<ng-content>` into the fresh child. */
34
35
 
35
36
  import {
36
37
  CONTEXT,
@@ -265,5 +266,28 @@ export const remountComponentClass = async (
265
266
  }
266
267
  }
267
268
 
269
+ if (remounted > 0) {
270
+ // Trigger an app-wide CD pass so the parent's template re-runs
271
+ // against the new child LView's slot. This is what re-applies
272
+ // `@Input` bindings (`<app-hero [foo]="bar">`) and re-projects
273
+ // `<ng-content>` content into the new instance — both are
274
+ // PARENT-template artifacts that Angular only re-evaluates
275
+ // during the parent's update pass, not during the child's
276
+ // fresh creation. Without this tick, a remounted component
277
+ // shows default field values until the user interacts and
278
+ // triggers a stray CD elsewhere.
279
+ const w = window as unknown as {
280
+ __ANGULAR_APP__?: { tick?: () => void };
281
+ };
282
+ try {
283
+ w.__ANGULAR_APP__?.tick?.();
284
+ } catch (err) {
285
+ console.error(
286
+ '[absolutejs] post-remount tick threw — partial state',
287
+ err
288
+ );
289
+ }
290
+ }
291
+
268
292
  return { className, remounted, skipped };
269
293
  };
package/dist/index.js CHANGED
@@ -19208,8 +19208,20 @@ ${block}
19208
19208
  if (methodsBlock) {
19209
19209
  const tail = `
19210
19210
  if (typeof _Fresh !== 'undefined') {
19211
- _Fresh.\u0275cmp = ${className}.\u0275cmp;
19212
- _Fresh.\u0275fac = function() { return new _Fresh(); };
19211
+ var __abs_liveFac = ${className}.\u0275fac;
19212
+ var __abs_freshFac = typeof __abs_liveFac === 'function'
19213
+ ? function(t) { return __abs_liveFac(t || _Fresh); }
19214
+ : function() { return new _Fresh(); };
19215
+ _Fresh.\u0275cmp = Object.assign(
19216
+ Object.create(Object.getPrototypeOf(${className}.\u0275cmp)),
19217
+ ${className}.\u0275cmp,
19218
+ {
19219
+ type: _Fresh,
19220
+ factory: __abs_freshFac,
19221
+ tView: null
19222
+ }
19223
+ );
19224
+ _Fresh.\u0275fac = __abs_freshFac;
19213
19225
  return _Fresh;
19214
19226
  }
19215
19227
  `;
@@ -30454,5 +30466,5 @@ export {
30454
30466
  ANGULAR_INIT_TIMEOUT_MS
30455
30467
  };
30456
30468
 
30457
- //# debugId=318C2BB565882B2764756E2164756E21
30469
+ //# debugId=A56696228D787EEA64756E2164756E21
30458
30470
  //# sourceMappingURL=index.js.map