@qwik.dev/core 2.0.0-beta.24 → 2.0.0-beta.26

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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core 2.0.0-beta.24-dev+314726b
3
+ * @qwik.dev/core 2.0.0-beta.26-dev+c693cf5
4
4
  * Copyright QwikDev. All Rights Reserved.
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
@@ -523,7 +523,7 @@ const isObjectEmpty = obj => {
523
523
  return !0;
524
524
  };
525
525
 
526
- const version = "2.0.0-beta.24-dev+314726b";
526
+ const version = "2.0.0-beta.26-dev+c693cf5";
527
527
 
528
528
  const createPlatform = () => ({
529
529
  isServer,
@@ -534,6 +534,7 @@ const createPlatform = () => ({
534
534
  if (regSym) {
535
535
  return regSym;
536
536
  }
537
+ throw qError(6, [ symbolName ]);
537
538
  }
538
539
  if (!url) {
539
540
  throw qError(14, [ symbolName ]);
@@ -1721,6 +1722,8 @@ const _jsxSplit = (type, varProps, constProps, children, flags, key, dev) => {
1721
1722
  }
1722
1723
  _hasOwnProperty$1.call(constProps, attr) && !processedKeys.has(attr) || (constProps[attr] = constProps[k]);
1723
1724
  delete constProps[k];
1725
+ } else {
1726
+ k === "bind:checked" ? bindCheckedSignal = constProps[k] : k === "bind:value" && (bindValueSignal = constProps[k]);
1724
1727
  }
1725
1728
  processedKeys.add(k);
1726
1729
  }
@@ -1744,46 +1747,65 @@ const _jsxSplit = (type, varProps, constProps, children, flags, key, dev) => {
1744
1747
  }
1745
1748
  processedKeys.add(k);
1746
1749
  }
1747
- if (bindCheckedSignal || bindValueSignal) {
1748
- if (!varPropsCopied) {
1749
- varProps = {
1750
- ...varProps
1751
- };
1752
- varPropsCopied = !0;
1750
+ }
1751
+ if (bindCheckedSignal || bindValueSignal) {
1752
+ if (!varPropsCopied) {
1753
+ varProps = {
1754
+ ...varProps
1755
+ };
1756
+ varPropsCopied = !0;
1757
+ }
1758
+ varProps ||= {};
1759
+ if (bindCheckedSignal) {
1760
+ varProps && _hasOwnProperty$1.call(varProps, "bind:checked") && delete varProps["bind:checked"];
1761
+ if (constProps && _hasOwnProperty$1.call(constProps, "bind:checked")) {
1762
+ if (!constPropsCopied) {
1763
+ constProps = {
1764
+ ...constProps
1765
+ };
1766
+ constPropsCopied = !0;
1767
+ }
1768
+ delete constProps["bind:checked"];
1753
1769
  }
1754
- if (bindCheckedSignal) {
1755
- delete varProps["bind:checked"];
1756
- varProps.checked = bindCheckedSignal;
1757
- const handler = createQRL(null, "_chk", _chk, null, [ bindCheckedSignal ]);
1758
- if (constProps && _hasOwnProperty$1.call(constProps, "q-e:input")) {
1759
- if (!constPropsCopied) {
1760
- constProps = {
1761
- ...constProps
1762
- };
1763
- constPropsCopied = !0;
1764
- }
1765
- const existingHandler = constProps["q-e:input"];
1766
- delete constProps["q-e:input"];
1767
- toSort = mergeHandlers(varProps, "q-e:input", existingHandler) || toSort;
1770
+ varProps.checked = bindCheckedSignal;
1771
+ const handler = createQRL(null, "_chk", _chk, null, [ bindCheckedSignal ]);
1772
+ if (constProps && _hasOwnProperty$1.call(constProps, "q-e:input")) {
1773
+ if (!constPropsCopied) {
1774
+ constProps = {
1775
+ ...constProps
1776
+ };
1777
+ constPropsCopied = !0;
1768
1778
  }
1769
- toSort = mergeHandlers(varProps, "q-e:input", handler) || toSort;
1770
- } else if (bindValueSignal) {
1771
- delete varProps["bind:value"];
1772
- varProps.value = bindValueSignal;
1773
- const handler = createQRL(null, "_val", _val, null, [ bindValueSignal ]);
1774
- if (constProps && _hasOwnProperty$1.call(constProps, "q-e:input")) {
1775
- if (!constPropsCopied) {
1776
- constProps = {
1777
- ...constProps
1778
- };
1779
- constPropsCopied = !0;
1780
- }
1781
- const existingHandler = constProps["q-e:input"];
1782
- delete constProps["q-e:input"];
1783
- toSort = mergeHandlers(varProps, "q-e:input", existingHandler) || toSort;
1779
+ const existingHandler = constProps["q-e:input"];
1780
+ delete constProps["q-e:input"];
1781
+ toSort = mergeHandlers(varProps, "q-e:input", existingHandler) || toSort;
1782
+ }
1783
+ toSort = mergeHandlers(varProps, "q-e:input", handler) || toSort;
1784
+ } else if (bindValueSignal) {
1785
+ varProps && _hasOwnProperty$1.call(varProps, "bind:value") && delete varProps["bind:value"];
1786
+ if (constProps && _hasOwnProperty$1.call(constProps, "bind:value")) {
1787
+ if (!constPropsCopied) {
1788
+ constProps = {
1789
+ ...constProps
1790
+ };
1791
+ constPropsCopied = !0;
1784
1792
  }
1785
- toSort = mergeHandlers(varProps, "q-e:input", handler) || toSort;
1793
+ delete constProps["bind:value"];
1786
1794
  }
1795
+ varProps.value = bindValueSignal;
1796
+ const handler = createQRL(null, "_val", _val, null, [ bindValueSignal ]);
1797
+ if (constProps && _hasOwnProperty$1.call(constProps, "q-e:input")) {
1798
+ if (!constPropsCopied) {
1799
+ constProps = {
1800
+ ...constProps
1801
+ };
1802
+ constPropsCopied = !0;
1803
+ }
1804
+ const existingHandler = constProps["q-e:input"];
1805
+ delete constProps["q-e:input"];
1806
+ toSort = mergeHandlers(varProps, "q-e:input", existingHandler) || toSort;
1807
+ }
1808
+ toSort = mergeHandlers(varProps, "q-e:input", handler) || toSort;
1787
1809
  }
1788
1810
  }
1789
1811
  if (varProps && _hasOwnProperty$1.call(varProps, "className")) {
@@ -2203,7 +2225,11 @@ const cleanupDestroyable = destroyable => {
2203
2225
  }
2204
2226
  };
2205
2227
 
2206
- function runEventHandlerQRL(handler, event, element, ctx = newInvokeContextFromDOM(event, element)) {
2228
+ function runEventHandlerQRL(handler, event, element, ctx) {
2229
+ if (!element.isConnected) {
2230
+ return;
2231
+ }
2232
+ ctx || (ctx = newInvokeContextFromDOM(event, element));
2207
2233
  const container = ctx.$container$;
2208
2234
  const hostElement = ctx.$hostElement$;
2209
2235
  vnode_ensureElementInflated(container, hostElement);
@@ -2231,6 +2257,9 @@ function runEventHandlerQRL(handler, event, element, ctx = newInvokeContextFromD
2231
2257
  }
2232
2258
 
2233
2259
  function _run(event, element) {
2260
+ if (!element.isConnected) {
2261
+ return;
2262
+ }
2234
2263
  const ctx = newInvokeContextFromDOM(event, element);
2235
2264
  typeof this === "string" && setCaptures(deserializeCaptures(ctx.$container$, this));
2236
2265
  const qrlToRun = _captures[0];
@@ -2251,37 +2280,39 @@ function setAttribute(journal, vnode, key, value, scopedStyleIdPrefix, originalV
2251
2280
  }
2252
2281
 
2253
2282
  const vnode_diff = (container, journal, jsxNode, vStartNode, cursor, scopedStyleIdPrefix) => {
2254
- const diffContext = {
2255
- container,
2256
- journal,
2257
- cursor,
2258
- scopedStyleIdPrefix,
2259
- stack: [],
2260
- asyncQueue: [],
2261
- asyncAttributePromises: [],
2262
- vParent: null,
2263
- vCurrent: null,
2264
- vNewNode: null,
2265
- vSiblings: null,
2266
- vSiblingsArray: null,
2267
- vSideBuffer: null,
2268
- jsxChildren: null,
2269
- jsxValue: null,
2270
- jsxIdx: 0,
2271
- jsxCount: 0,
2272
- shouldAdvance: !0,
2273
- isCreationMode: !1,
2274
- subscriptionData: {
2275
- const: new SubscriptionData({
2276
- $scopedStyleIdPrefix$: scopedStyleIdPrefix,
2277
- $isConst$: !0
2278
- }),
2279
- var: new SubscriptionData({
2280
- $scopedStyleIdPrefix$: scopedStyleIdPrefix,
2281
- $isConst$: !1
2282
- })
2283
- }
2284
- };
2283
+ const diffContext = function createDiffContext(container, journal, cursor, scopedStyleIdPrefix) {
2284
+ return {
2285
+ container,
2286
+ journal,
2287
+ cursor,
2288
+ scopedStyleIdPrefix,
2289
+ stack: [],
2290
+ asyncQueue: [],
2291
+ asyncAttributePromises: [],
2292
+ vParent: null,
2293
+ vCurrent: null,
2294
+ vNewNode: null,
2295
+ vSiblings: null,
2296
+ vSiblingsArray: null,
2297
+ vSideBuffer: null,
2298
+ jsxChildren: null,
2299
+ jsxValue: null,
2300
+ jsxIdx: 0,
2301
+ jsxCount: 0,
2302
+ shouldAdvance: !0,
2303
+ isCreationMode: !1,
2304
+ subscriptionData: {
2305
+ const: new SubscriptionData({
2306
+ $scopedStyleIdPrefix$: scopedStyleIdPrefix,
2307
+ $isConst$: !0
2308
+ }),
2309
+ var: new SubscriptionData({
2310
+ $scopedStyleIdPrefix$: scopedStyleIdPrefix,
2311
+ $isConst$: !1
2312
+ })
2313
+ }
2314
+ };
2315
+ }(container, journal, cursor, scopedStyleIdPrefix);
2285
2316
  diff(diffContext, jsxNode, vStartNode);
2286
2317
  const result = drainAsyncQueue(diffContext);
2287
2318
  if (isPromise(result)) {
@@ -2498,6 +2529,7 @@ function expectSlot(diffContext) {
2498
2529
  vnode_setProp(diffContext.vNewNode, QSlot, slotNameKey);
2499
2530
  vHost && vnode_setProp(vHost, slotNameKey, diffContext.vNewNode);
2500
2531
  isDev && vnode_setProp(diffContext.vNewNode, "q:type", "P");
2532
+ vnode_inflateProjectionTrailingText(diffContext.journal, diffContext.vNewNode);
2501
2533
  vnode_insertBefore(diffContext.journal, diffContext.vParent, diffContext.vNewNode, diffContext.vCurrent && getInsertBefore(diffContext));
2502
2534
  oldParent && vnode_isElementVNode(oldParent) && !oldParent.firstChild && vnode_getElementName(oldParent) === "q:template" && vnode_remove(diffContext.journal, oldParent.parent, oldParent, !0);
2503
2535
  }
@@ -2915,7 +2947,7 @@ function expectComponent(diffContext, component) {
2915
2947
  const lookupKeysAreEqual = lookupKey === vNodeLookupKey;
2916
2948
  const hashesAreEqual = componentHash === vNodeComponentHash;
2917
2949
  if (lookupKeysAreEqual) {
2918
- if (hashesAreEqual && jsxNode.key) {
2950
+ if (hashesAreEqual) {
2919
2951
  deleteFromSideBuffer(diffContext, null, lookupKey);
2920
2952
  } else {
2921
2953
  insertNewComponent(diffContext, host, componentQRL, jsxProps);
@@ -2931,20 +2963,28 @@ function expectComponent(diffContext, component) {
2931
2963
  }
2932
2964
  if (host) {
2933
2965
  const vNodeProps = vnode_getProp(host, "q:props", diffContext.container.$getObjectById$);
2934
- shouldRender || (shouldRender ||= function handleProps(host, jsxProps, vNodeProps, container) {
2935
- let shouldRender = !1;
2936
- if (vNodeProps) {
2937
- const constPropsDifferent = handleChangedProps(jsxProps[_CONST_PROPS], vNodeProps[_CONST_PROPS], vNodeProps[_PROPS_HANDLER], container, !1);
2938
- shouldRender ||= constPropsDifferent;
2939
- const varPropsDifferent = handleChangedProps(jsxProps[_VAR_PROPS], vNodeProps[_VAR_PROPS], vNodeProps[_PROPS_HANDLER], container, !0);
2940
- shouldRender ||= varPropsDifferent;
2941
- vNodeProps[_OWNER] = jsxProps[_OWNER];
2942
- } else if (jsxProps) {
2943
- vnode_setProp(host, "q:props", jsxProps);
2944
- vNodeProps = jsxProps;
2966
+ if (!shouldRender) {
2967
+ const propsChanged = function handleProps(host, jsxProps, vNodeProps, container) {
2968
+ let shouldRender = !1;
2969
+ if (vNodeProps) {
2970
+ const constPropsDifferent = handleChangedProps(jsxProps[_CONST_PROPS], vNodeProps[_CONST_PROPS], vNodeProps[_PROPS_HANDLER], container, !1);
2971
+ shouldRender ||= constPropsDifferent;
2972
+ const varPropsDifferent = handleChangedProps(jsxProps[_VAR_PROPS], vNodeProps[_VAR_PROPS], vNodeProps[_PROPS_HANDLER], container, !0);
2973
+ shouldRender ||= varPropsDifferent;
2974
+ vNodeProps[_OWNER] = jsxProps[_OWNER];
2975
+ } else if (jsxProps) {
2976
+ vnode_setProp(host, "q:props", jsxProps);
2977
+ vNodeProps = jsxProps;
2978
+ }
2979
+ return shouldRender;
2980
+ }(host, jsxProps, vNodeProps, diffContext.container);
2981
+ if (propsChanged && jsxNode.key == null) {
2982
+ insertNewComponent(diffContext, host, componentQRL, jsxProps);
2983
+ host = diffContext.vNewNode;
2984
+ shouldRender = !0;
2945
2985
  }
2946
- return shouldRender;
2947
- }(host, jsxProps, vNodeProps, diffContext.container));
2986
+ shouldRender ||= propsChanged;
2987
+ }
2948
2988
  if (shouldRender) {
2949
2989
  vnode_setProp(host, "q:renderFn", componentQRL);
2950
2990
  host.flags &= -33;
@@ -2989,7 +3029,7 @@ function expectComponent(diffContext, component) {
2989
3029
  const lookupKeysAreEqual = lookupKey === vNodeLookupKey;
2990
3030
  const vNodeComponentHash = getComponentHash(host, diffContext.container.$getObjectById$);
2991
3031
  const isInlineComponent = vNodeComponentHash == null;
2992
- if (host && !isInlineComponent || lookupKey == null) {
3032
+ if (host && !isInlineComponent || !host) {
2993
3033
  insertNewInlineComponent(diffContext);
2994
3034
  host = diffContext.vNewNode;
2995
3035
  } else if (lookupKeysAreEqual) {
@@ -3495,7 +3535,7 @@ function walkCursor(cursor, options) {
3495
3535
  });
3496
3536
  return;
3497
3537
  }
3498
- if (!isRunningOnServer && !import.meta.env.TEST) {
3538
+ if (isBrowser) {
3499
3539
  const elapsed = performance.now() - startTime;
3500
3540
  if (elapsed >= timeBudget) {
3501
3541
  scheduleYield();
@@ -3670,7 +3710,7 @@ function getNextVNode(vNode, cursor) {
3670
3710
  return null;
3671
3711
  }
3672
3712
  let parent = null;
3673
- vNode.parent && vNode.parent.dirty & 32 ? parent = vNode.parent : vNode.slotParent && vNode.slotParent.dirty & 32 && (parent = vNode.slotParent);
3713
+ vNode.slotParent && vNode.slotParent.dirty & 32 ? parent = vNode.slotParent : vNode.parent && vNode.parent.dirty & 32 && (parent = vNode.parent);
3674
3714
  if (!parent) {
3675
3715
  if (cursor.dirty & 127) {
3676
3716
  return cursor;
@@ -3756,7 +3796,7 @@ function propagatePath(target) {
3756
3796
  const parent = reusablePath[i + 1] || target;
3757
3797
  parent.dirty |= 32;
3758
3798
  parent.dirtyChildren ||= [];
3759
- parent.dirtyChildren.push(child);
3799
+ parent.dirtyChildren.includes(child) || parent.dirtyChildren.push(child);
3760
3800
  }
3761
3801
  }
3762
3802
 
@@ -3774,11 +3814,11 @@ function markVNodeDirty(container, vNode, bits, cursorRoot = null) {
3774
3814
  if ((isRealDirty ? prevDirty & 127 : prevDirty) || vNode === cursorRoot) {
3775
3815
  return;
3776
3816
  }
3777
- const parent = vNode.parent || vNode.slotParent;
3817
+ const parent = vNode.slotParent || vNode.parent;
3778
3818
  if (cursorRoot && isRealDirty && parent && !parent.dirty) {
3779
3819
  (function propagateToCursorRoot(vNode, cursorRoot) {
3780
3820
  reusablePath.push(vNode);
3781
- let current = vNode.parent || vNode.slotParent;
3821
+ let current = vNode.slotParent || vNode.parent;
3782
3822
  for (;current; ) {
3783
3823
  const isDirty = current.dirty & 127;
3784
3824
  const currentIsCursor = isCursor(current);
@@ -3796,7 +3836,7 @@ function markVNodeDirty(container, vNode, bits, cursorRoot = null) {
3796
3836
  cursorData.position !== current && (cursorData.position = vNode);
3797
3837
  }
3798
3838
  reusablePath.push(current);
3799
- current = current.parent || current.slotParent;
3839
+ current = current.slotParent || current.parent;
3800
3840
  }
3801
3841
  reusablePath.length = 0;
3802
3842
  throwErrorAndStop("Cursor root not found in current path!");
@@ -3806,7 +3846,7 @@ function markVNodeDirty(container, vNode, bits, cursorRoot = null) {
3806
3846
  if (parent && parent.dirty & 127) {
3807
3847
  isRealDirty && (parent.dirty |= 32);
3808
3848
  parent.dirtyChildren ||= [];
3809
- parent.dirtyChildren.push(vNode);
3849
+ parent.dirtyChildren.includes(vNode) || parent.dirtyChildren.push(vNode);
3810
3850
  if (isRealDirty && vNode.dirtyChildren) {
3811
3851
  const cursor = function findCursor(vNode) {
3812
3852
  for (;vNode; ) {
@@ -3822,7 +3862,7 @@ function markVNodeDirty(container, vNode, bits, cursorRoot = null) {
3822
3862
  let cursorPosition = cursorData.position;
3823
3863
  if (cursorPosition) {
3824
3864
  for (;cursorPosition !== cursor; ) {
3825
- cursorPosition = cursorPosition.parent || cursorPosition.slotParent;
3865
+ cursorPosition = cursorPosition.slotParent || cursorPosition.parent;
3826
3866
  if (cursorPosition === vNode) {
3827
3867
  cursorData.position = vNode;
3828
3868
  break;
@@ -3834,7 +3874,7 @@ function markVNodeDirty(container, vNode, bits, cursorRoot = null) {
3834
3874
  } else {
3835
3875
  isCursor(vNode) || function findAndPropagateToBlockingCursor(vNode) {
3836
3876
  reusablePath.push(vNode);
3837
- let current = vNode.parent || vNode.slotParent;
3877
+ let current = vNode.slotParent || vNode.parent;
3838
3878
  for (;current; ) {
3839
3879
  const currentIsCursor = isCursor(current);
3840
3880
  if (currentIsCursor) {
@@ -3843,7 +3883,7 @@ function markVNodeDirty(container, vNode, bits, cursorRoot = null) {
3843
3883
  return !0;
3844
3884
  }
3845
3885
  reusablePath.push(current);
3846
- current = current.parent || current.slotParent;
3886
+ current = current.slotParent || current.parent;
3847
3887
  }
3848
3888
  reusablePath.length = 0;
3849
3889
  return !1;
@@ -4064,6 +4104,7 @@ function vnode_walkDirectChildren(journal, vParent, callback) {
4064
4104
  function vnode_walkVNode(vNode, callback) {
4065
4105
  let vCursor = vNode;
4066
4106
  if (vnode_isTextVNode(vNode)) {
4107
+ callback?.(vNode, null);
4067
4108
  return;
4068
4109
  }
4069
4110
  let vParent = null;
@@ -4435,9 +4476,7 @@ const vnode_insertVirtualBefore = (journal, parent, newChild, insertBefore) => {
4435
4476
  const vnode_findInsertBefore = (journal, parent, insertBefore) => {
4436
4477
  let adjustedInsertBefore = null;
4437
4478
  insertBefore == null ? vnode_isVirtualVNode(parent) && (adjustedInsertBefore = vnode_getDomSibling(parent, !0, !1)) : adjustedInsertBefore = vnode_isVirtualVNode(insertBefore) ? vnode_getDomSibling(insertBefore, !0, !0) : insertBefore;
4438
- adjustedInsertBefore && ((journal, vNode) => {
4439
- vnode_isTextVNode(vNode) && vnode_ensureTextInflated(journal, vNode);
4440
- })(journal, adjustedInsertBefore);
4479
+ adjustedInsertBefore && vnode_isTextVNode(adjustedInsertBefore) && vnode_ensureTextInflated(journal, adjustedInsertBefore);
4441
4480
  return adjustedInsertBefore;
4442
4481
  };
4443
4482
 
@@ -4454,6 +4493,14 @@ const vnode_unlinkFromOldParent = (journal, currentParent, newParent, newChild)
4454
4493
  currentParent && (newChild.previousSibling || newChild.nextSibling || currentParent !== newParent) && vnode_remove(journal, currentParent, newChild, !1);
4455
4494
  };
4456
4495
 
4496
+ const vnode_inflateProjectionTrailingText = (journal, projection) => {
4497
+ let last = projection;
4498
+ for (;last && vnode_isVirtualVNode(last); ) {
4499
+ last = last.lastChild;
4500
+ }
4501
+ last && vnode_isTextVNode(last) && (last.flags & 8) === 0 && vnode_ensureTextInflated(journal, last);
4502
+ };
4503
+
4457
4504
  const vnode_insertBefore = (journal, parent, newChild, insertBefore) => {
4458
4505
  vnode_isElementOrTextVNode(newChild) ? vnode_insertElementBefore(journal, parent, newChild, insertBefore) : vnode_insertVirtualBefore(journal, parent, newChild, insertBefore);
4459
4506
  };
@@ -4617,6 +4664,12 @@ const ensureMaterialized = vnode => {
4617
4664
  vnode_ensureElementKeyInflated(elementVNode);
4618
4665
  addVNode(elementVNode);
4619
4666
  child = fastNextSibling(child);
4667
+ for (;isElement(child) && shouldSkipElement(child); ) {
4668
+ child = fastNextSibling(child);
4669
+ if (!child && value > 0) {
4670
+ throw qError(27, [ vData, peek(), nextToConsumeIdx ]);
4671
+ }
4672
+ }
4620
4673
  }
4621
4674
  } else if (peek() === 59) {
4622
4675
  vnode_setProp(vParent, "q:sstyle", consumeValue());
@@ -5836,7 +5889,7 @@ class Serializer {
5836
5889
  } else if (value instanceof SubscriptionData) {
5837
5890
  this.output(31, [ value.data.$scopedStyleIdPrefix$, value.data.$isConst$ ]);
5838
5891
  } else if (value instanceof EffectSubscription) {
5839
- this.output(32, [ value.consumer, value.property, value.backRef, value.data ]);
5892
+ this.output(32, [ value.consumer, value.property, value.data ]);
5840
5893
  } else if (isStore(value)) {
5841
5894
  const storeHandler = getStoreHandler(value);
5842
5895
  const storeTarget = getStoreTarget(value);
@@ -5900,12 +5953,12 @@ class Serializer {
5900
5953
  const forwardRefId = this.resolvePromise(maybeValue, (resolved, resolvedValue) => new PromiseResult(26, resolved, resolvedValue, value.$effects$, value.$computeQrl$));
5901
5954
  this.output(2, forwardRefId);
5902
5955
  } else {
5903
- this.output(26, [ value.$computeQrl$, filterEffectBackRefs(value[_EFFECT_BACK_REF]), value.$effects$, maybeValue ]);
5956
+ this.output(26, [ value.$computeQrl$, value.$effects$, maybeValue ]);
5904
5957
  }
5905
5958
  return;
5906
5959
  }
5907
5960
  if (value instanceof WrappedSignalImpl) {
5908
- this.output(23, [ ...serializeWrappingFn(this.$serializationContext$, value), filterEffectBackRefs(value[_EFFECT_BACK_REF]), value.$flags$, value.$hostElement$, ...value.$effects$ || [] ]);
5961
+ this.output(23, [ ...serializeWrappingFn(this.$serializationContext$, value), value.$flags$, value.$hostElement$, ...value.$effects$ || [] ]);
5909
5962
  } else if (value instanceof ComputedSignalImpl) {
5910
5963
  let v = value.$untrackedValue$;
5911
5964
  const shouldAlwaysSerialize = value.$flags$ & 16;
@@ -5918,7 +5971,7 @@ class Serializer {
5918
5971
  const timeout = isAsync && value.$timeoutMs$ !== 0 ? value.$timeoutMs$ : void 0;
5919
5972
  const asyncFlags = isAsync && value.$flags$ & -25 || void 0;
5920
5973
  isInvalid || isSkippable ? v = NEEDS_COMPUTATION : shouldAlwaysSerialize ? v = value.$untrackedValue$ : shouldNeverSerialize && (v = NEEDS_COMPUTATION);
5921
- const out = [ value.$computeQrl$, filterEffectBackRefs(value[_EFFECT_BACK_REF]), value.$effects$ ];
5974
+ const out = [ value.$computeQrl$, value.$effects$ ];
5922
5975
  if (isAsync) {
5923
5976
  out.push(value.$loadingEffects$, value.$errorEffects$, value.$untrackedError$);
5924
5977
  out.push(asyncFlags || void 0);
@@ -6001,7 +6054,7 @@ class Serializer {
6001
6054
  }
6002
6055
  this.output(29, out);
6003
6056
  } else if (value instanceof Task) {
6004
- const out = [ value.$qrl$, value.$flags$, value.$index$, value.$el$, value[_EFFECT_BACK_REF], value.$state$ ];
6057
+ const out = [ value.$qrl$, value.$flags$, value.$index$, value.$el$, value.$state$ ];
6005
6058
  for (;out[out.length - 1] === void 0; ) {
6006
6059
  out.pop();
6007
6060
  }
@@ -6138,19 +6191,6 @@ function serializeWrappingFn(serializationContext, value) {
6138
6191
  return [ syncFnId, value.$args$ ];
6139
6192
  }
6140
6193
 
6141
- function filterEffectBackRefs(effectBackRef) {
6142
- let effectBackRefToSerialize;
6143
- if (effectBackRef) {
6144
- for (const [effectProp, effect] of effectBackRef) {
6145
- if (effect.backRef) {
6146
- effectBackRefToSerialize ||= new Map;
6147
- effectBackRefToSerialize.set(effectProp, effect);
6148
- }
6149
- }
6150
- }
6151
- return effectBackRefToSerialize;
6152
- }
6153
-
6154
6194
  function tryGetBackRefs(props) {
6155
6195
  return Object.prototype.hasOwnProperty.call(props, "q:brefs") ? props["q:brefs"] : void 0;
6156
6196
  }
@@ -6682,8 +6722,7 @@ const inflate = (container, target, typeId, data) => {
6682
6722
  task.$flags$ = v[1];
6683
6723
  task.$index$ = v[2];
6684
6724
  task.$el$ = v[3];
6685
- task[_EFFECT_BACK_REF] = v[4];
6686
- task.$state$ = v[5];
6725
+ task.$state$ = v[4];
6687
6726
  break;
6688
6727
 
6689
6728
  case 21:
@@ -6702,6 +6741,7 @@ const inflate = (container, target, typeId, data) => {
6702
6741
  const storeHandler = getStoreHandler(target);
6703
6742
  storeHandler.$flags$ = flags;
6704
6743
  storeHandler.$effects$ = effects;
6744
+ restoreEffectBackRefForEffectsMap(storeHandler.$effects$, store);
6705
6745
  break;
6706
6746
  }
6707
6747
 
@@ -6711,6 +6751,7 @@ const inflate = (container, target, typeId, data) => {
6711
6751
  const d = data;
6712
6752
  signal.$untrackedValue$ = d[0];
6713
6753
  signal.$effects$ = new Set(d.slice(1));
6754
+ restoreEffectBackRefForEffects(signal.$effects$, signal);
6714
6755
  break;
6715
6756
  }
6716
6757
 
@@ -6720,12 +6761,11 @@ const inflate = (container, target, typeId, data) => {
6720
6761
  const d = data;
6721
6762
  signal.$func$ = container.getSyncFn(d[0]);
6722
6763
  signal.$args$ = d[1];
6723
- signal[_EFFECT_BACK_REF] = d[2];
6724
6764
  signal.$untrackedValue$ = NEEDS_COMPUTATION;
6725
- signal.$flags$ = d[3];
6765
+ signal.$flags$ = d[2];
6726
6766
  signal.$flags$ |= 1;
6727
- signal.$hostElement$ = d[4];
6728
- signal.$effects$ = new Set(d.slice(5));
6767
+ signal.$hostElement$ = d[3];
6768
+ signal.$effects$ = new Set(d.slice(4));
6729
6769
  (function inflateWrappedSignalValue(signal) {
6730
6770
  if (signal.$hostElement$ !== null && vnode_isVNode(signal.$hostElement$)) {
6731
6771
  const hostVNode = signal.$hostElement$;
@@ -6750,6 +6790,7 @@ const inflate = (container, target, typeId, data) => {
6750
6790
  }
6751
6791
  }
6752
6792
  })(signal);
6793
+ restoreEffectBackRefForEffects(signal.$effects$, signal);
6753
6794
  break;
6754
6795
  }
6755
6796
 
@@ -6758,19 +6799,21 @@ const inflate = (container, target, typeId, data) => {
6758
6799
  const asyncSignal = target;
6759
6800
  const d = data;
6760
6801
  asyncSignal.$computeQrl$ = d[0];
6761
- asyncSignal[_EFFECT_BACK_REF] = d[1];
6762
- asyncSignal.$effects$ = new Set(d[2]);
6763
- asyncSignal.$loadingEffects$ = new Set(d[3]);
6764
- asyncSignal.$errorEffects$ = new Set(d[4]);
6765
- asyncSignal.$untrackedError$ = d[5];
6766
- asyncSignal.$flags$ = d[6] ?? 0;
6802
+ asyncSignal.$effects$ = new Set(d[1]);
6803
+ asyncSignal.$loadingEffects$ = new Set(d[2]);
6804
+ asyncSignal.$errorEffects$ = new Set(d[3]);
6805
+ asyncSignal.$untrackedError$ = d[4];
6806
+ asyncSignal.$flags$ = d[5] ?? 0;
6767
6807
  asyncSignal.$flags$ & 64 && (asyncSignal.$untrackedLoading$ = !0);
6768
- const hasValue = d.length > 7;
6769
- hasValue && (asyncSignal.$untrackedValue$ = d[7]);
6808
+ const hasValue = d.length > 6;
6809
+ hasValue && (asyncSignal.$untrackedValue$ = d[6]);
6770
6810
  asyncSignal.$untrackedValue$ === NEEDS_COMPUTATION && (asyncSignal.$flags$ |= 1);
6771
- asyncSignal.interval = d[8] ?? 0;
6772
- asyncSignal.$concurrency$ = d[9] ?? 1;
6773
- asyncSignal.$timeoutMs$ = d[10] ?? 0;
6811
+ asyncSignal.interval = d[7] ?? 0;
6812
+ asyncSignal.$concurrency$ = d[8] ?? 1;
6813
+ asyncSignal.$timeoutMs$ = d[9] ?? 0;
6814
+ restoreEffectBackRefForEffects(asyncSignal.$effects$, asyncSignal);
6815
+ restoreEffectBackRefForEffects(asyncSignal.$loadingEffects$, asyncSignal);
6816
+ restoreEffectBackRefForEffects(asyncSignal.$errorEffects$, asyncSignal);
6774
6817
  break;
6775
6818
  }
6776
6819
 
@@ -6782,11 +6825,11 @@ const inflate = (container, target, typeId, data) => {
6782
6825
  computed.$computeQrl$ = d[0];
6783
6826
  const p = computed.$computeQrl$.resolve(container).catch(() => {});
6784
6827
  loading = loading.finally(() => p);
6785
- computed[_EFFECT_BACK_REF] = d[1];
6786
- d[2] && (computed.$effects$ = new Set(d[2]));
6787
- const hasValue = d.length > 3;
6788
- hasValue && (computed.$untrackedValue$ = d[3]);
6828
+ d[1] && (computed.$effects$ = new Set(d[1]));
6829
+ const hasValue = d.length > 2;
6830
+ hasValue && (computed.$untrackedValue$ = d[2]);
6789
6831
  typeId !== 26 && computed.$untrackedValue$ !== NEEDS_COMPUTATION && (computed.$flags$ &= -2);
6832
+ restoreEffectBackRefForEffects(computed.$effects$, computed);
6790
6833
  break;
6791
6834
  }
6792
6835
 
@@ -6870,7 +6913,9 @@ const inflate = (container, target, typeId, data) => {
6870
6913
  owner._proxy = propsProxy;
6871
6914
  }
6872
6915
  propsProxy[_OWNER] = owner;
6873
- propsProxy[_PROPS_HANDLER].$effects$ = d[3];
6916
+ const propsHandler = propsProxy[_PROPS_HANDLER];
6917
+ propsHandler.$effects$ = d[3];
6918
+ restoreEffectBackRefForEffectsMap(propsHandler.$effects$, propsProxy);
6874
6919
  break;
6875
6920
 
6876
6921
  case 31:
@@ -6887,8 +6932,16 @@ const inflate = (container, target, typeId, data) => {
6887
6932
  const d = data;
6888
6933
  effectSub.consumer = d[0];
6889
6934
  effectSub.property = d[1];
6890
- effectSub.backRef = d[2];
6891
- effectSub.data = d[3];
6935
+ effectSub.data = d[2];
6936
+ (function restoreEffectBackRefForConsumer(effect) {
6937
+ const isServerSide = import.meta.env.TEST ? isServerPlatform() : isServer;
6938
+ const consumerBackRef = effect.consumer;
6939
+ if (isServerSide && !consumerBackRef) {
6940
+ return;
6941
+ }
6942
+ consumerBackRef[_EFFECT_BACK_REF] ||= new Map;
6943
+ consumerBackRef[_EFFECT_BACK_REF].set(effect.property, effect);
6944
+ })(effectSub);
6892
6945
  break;
6893
6946
  }
6894
6947
 
@@ -6913,6 +6966,23 @@ function deserializeData(container, typeId, value) {
6913
6966
  return propValue;
6914
6967
  }
6915
6968
 
6969
+ function restoreEffectBackRefForEffects(effects, consumer) {
6970
+ if (effects) {
6971
+ for (const effect of effects) {
6972
+ effect.backRef ||= new Set;
6973
+ effect.backRef.add(consumer);
6974
+ }
6975
+ }
6976
+ }
6977
+
6978
+ function restoreEffectBackRefForEffectsMap(effectsMap, consumer) {
6979
+ if (effectsMap) {
6980
+ for (const [, effects] of effectsMap) {
6981
+ restoreEffectBackRefForEffects(effects, consumer);
6982
+ }
6983
+ }
6984
+ }
6985
+
6916
6986
  const needsInflation = typeId => typeId >= 15 || typeId === 4 || typeId === 5;
6917
6987
 
6918
6988
  const deserializedProxyMap = new WeakMap;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qwik.dev/core/loader",
3
- "version": "2.0.0-beta.24-dev+314726b",
3
+ "version": "2.0.0-beta.26-dev+c693cf5",
4
4
  "main": "index.mjs",
5
5
  "types": "index.d.ts",
6
6
  "private": true,