codexly-ui 0.10.68 → 0.10.69
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/fesm2022/codexly-ui.mjs
CHANGED
|
@@ -14457,11 +14457,21 @@ class ClxProductDetailComponent {
|
|
|
14457
14457
|
{ id: 'specs', label: 'Especificaciones' },
|
|
14458
14458
|
{ id: 'description', label: 'Descripción' },
|
|
14459
14459
|
];
|
|
14460
|
+
/** Tracks which product the spec selection was initialized for — the init effect below must run
|
|
14461
|
+
* once per actual product change, not every time initialVariationId() changes. A host app that
|
|
14462
|
+
* syncs its own ?variant= URL param from the (variationChange) output (see codexly-store's
|
|
14463
|
+
* product-detail page) feeds that id back into this same input; without this guard, every spec
|
|
14464
|
+
* click would round-trip through the host and re-trigger initialization, silently overwriting
|
|
14465
|
+
* the visitor's in-progress selection with the just-resolved variation's full spec set. */
|
|
14466
|
+
_initializedForProductId = null;
|
|
14460
14467
|
constructor() {
|
|
14461
14468
|
effect(() => {
|
|
14462
14469
|
const p = this.product();
|
|
14463
14470
|
if (!p?.variations?.length)
|
|
14464
14471
|
return;
|
|
14472
|
+
if (this._initializedForProductId === p.product_id)
|
|
14473
|
+
return;
|
|
14474
|
+
this._initializedForProductId = p.product_id;
|
|
14465
14475
|
const initialId = this.initialVariationId();
|
|
14466
14476
|
const initial = (initialId && p.variations.find(v => v.id === initialId)) || p.variations[0];
|
|
14467
14477
|
this._initialVariation.set(initial);
|