@lwc/engine-core 8.1.0-alpha.1 → 8.1.0-alpha.3
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/dist/index.cjs.js +16 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +17 -5
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs.js
CHANGED
|
@@ -328,6 +328,10 @@ function logMutation(reactiveObserver, target, key) {
|
|
|
328
328
|
if (shared.isUndefined(parentKey)) {
|
|
329
329
|
prop = stringKey;
|
|
330
330
|
}
|
|
331
|
+
else if (!shared.isString(key)) {
|
|
332
|
+
// symbol/number, e.g. `obj[Symbol("foo")]` or `obj[1234]`
|
|
333
|
+
prop = `${shared.toString(parentKey)}[${stringKey}]`;
|
|
334
|
+
}
|
|
331
335
|
else if (/^\w+$/.test(stringKey)) {
|
|
332
336
|
// Human-readable prop like `items[0].name` on a deep object/array
|
|
333
337
|
prop = `${shared.toString(parentKey)}.${stringKey}`;
|
|
@@ -363,6 +367,10 @@ function associateReactiveObserverWithVM(reactiveObserver, vm) {
|
|
|
363
367
|
*/
|
|
364
368
|
function trackTargetForMutationLogging(key, target) {
|
|
365
369
|
assertNotProd();
|
|
370
|
+
if (targetsToPropertyKeys.has(target)) {
|
|
371
|
+
// Guard against recursive objects - don't traverse forever
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
366
374
|
if (shared.isObject(target) && !shared.isNull(target)) {
|
|
367
375
|
// only track non-primitives; others are invalid as WeakMap keys
|
|
368
376
|
targetsToPropertyKeys.set(target, key);
|
|
@@ -373,8 +381,12 @@ function trackTargetForMutationLogging(key, target) {
|
|
|
373
381
|
}
|
|
374
382
|
}
|
|
375
383
|
else {
|
|
376
|
-
|
|
377
|
-
|
|
384
|
+
// Track only own property names and symbols (including non-enumerated)
|
|
385
|
+
// This is consistent with what observable-membrane does:
|
|
386
|
+
// https://github.com/salesforce/observable-membrane/blob/b85417f/src/base-handler.ts#L142-L143
|
|
387
|
+
const props = [...shared.getOwnPropertyNames(target), ...shared.getOwnPropertySymbols(target)];
|
|
388
|
+
for (const prop of props) {
|
|
389
|
+
trackTargetForMutationLogging(`${shared.toString(key)}.${shared.toString(prop)}`, target[prop]);
|
|
378
390
|
}
|
|
379
391
|
}
|
|
380
392
|
}
|
|
@@ -6944,7 +6956,7 @@ let rehydrateQueue = [];
|
|
|
6944
6956
|
function flushRehydrationQueue() {
|
|
6945
6957
|
// Gather the logs before rehydration starts so they can be reported at the end of rehydration.
|
|
6946
6958
|
// Note that we also clear all existing logs at this point so that subsequent re-renders start from a clean slate.
|
|
6947
|
-
const mutationLogs = process.env.NODE_ENV
|
|
6959
|
+
const mutationLogs = process.env.NODE_ENV === 'production' ? undefined : getAndFlushMutationLogs();
|
|
6948
6960
|
logGlobalOperationStart(8 /* OperationId.GlobalRehydrate */);
|
|
6949
6961
|
if (process.env.NODE_ENV !== 'production') {
|
|
6950
6962
|
shared.assert.invariant(rehydrateQueue.length, `If rehydrateQueue was scheduled, it is because there must be at least one VM on this pending queue instead of ${rehydrateQueue}.`);
|
|
@@ -8382,5 +8394,5 @@ exports.swapTemplate = swapTemplate;
|
|
|
8382
8394
|
exports.track = track;
|
|
8383
8395
|
exports.unwrap = unwrap;
|
|
8384
8396
|
exports.wire = wire;
|
|
8385
|
-
/** version: 8.1.0-alpha.
|
|
8397
|
+
/** version: 8.1.0-alpha.3 */
|
|
8386
8398
|
//# sourceMappingURL=index.cjs.js.map
|