@webjsdev/core 0.7.33 → 0.7.34
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.
package/package.json
CHANGED
package/src/router-client.js
CHANGED
|
@@ -2666,12 +2666,42 @@ function diffElementInPlace(dst, src) {
|
|
|
2666
2666
|
// The attribute version is skipped above; we deliberately do nothing
|
|
2667
2667
|
// here so the user's typing / checking is never blown away.
|
|
2668
2668
|
|
|
2669
|
+
// A hydrated component OWNS its rendered subtree. The client renderer
|
|
2670
|
+
// stashes the live template instance (lit-html parts holding DIRECT
|
|
2671
|
+
// references to the rendered nodes) on the host under
|
|
2672
|
+
// `Symbol.for('webjs.instance')`. Recursing into those children would
|
|
2673
|
+
// import/remove/reorder the very nodes the parts still point at, so the
|
|
2674
|
+
// component's next reactive update would write into detached nodes and
|
|
2675
|
+
// silently do nothing (a dead click after a soft nav, #906). Treat the
|
|
2676
|
+
// component as opaque: the attribute sync above already drove any reactive
|
|
2677
|
+
// property change through `attributeChangedCallback`, so the component
|
|
2678
|
+
// re-renders ITSELF; the router must not touch its internals. This mirrors
|
|
2679
|
+
// Turbo/morphdom, which leave custom elements alone by default.
|
|
2680
|
+
if (isHydratedComponent(dst)) return;
|
|
2681
|
+
|
|
2669
2682
|
// Recurse into children: collect both sides, run reconcileSiblings on
|
|
2670
2683
|
// them with synthetic boundary markers. Cheap implementation: use
|
|
2671
2684
|
// virtual ranges instead of inserting real comment markers.
|
|
2672
2685
|
reconcileChildren(dst, src);
|
|
2673
2686
|
}
|
|
2674
2687
|
|
|
2688
|
+
/**
|
|
2689
|
+
* True when `el` carries a live client-side render instance, i.e. a webjs
|
|
2690
|
+
* component whose `render()` produced the current children and owns them via
|
|
2691
|
+
* lit-html parts. The router must not reconcile INTO such an element (#906).
|
|
2692
|
+
*
|
|
2693
|
+
* Detected via the render-client instance symbol rather than a `customElements`
|
|
2694
|
+
* lookup so it fires only for elements that have actually rendered client-side:
|
|
2695
|
+
* a not-yet-upgraded or purely display-only custom element (no client render,
|
|
2696
|
+
* no parts to corrupt) stays fully reconcilable.
|
|
2697
|
+
*
|
|
2698
|
+
* @param {Element} el
|
|
2699
|
+
* @returns {boolean}
|
|
2700
|
+
*/
|
|
2701
|
+
function isHydratedComponent(el) {
|
|
2702
|
+
return /** @type {any} */ (el)[Symbol.for('webjs.instance')] != null;
|
|
2703
|
+
}
|
|
2704
|
+
|
|
2675
2705
|
/**
|
|
2676
2706
|
* Reconcile dst's children to match src's children, in-place.
|
|
2677
2707
|
*
|