chore: create stack lazily when proxying value (#15547)

pull/15548/head
Rich Harris 6 months ago committed by GitHub
parent 701f085c82
commit 99ca7a4d7f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -25,11 +25,6 @@ import { tracing_mode_flag } from '../flags/index.js';
* @returns {T}
*/
export function proxy(value, parent = null, prev) {
/** @type {Error | null} */
var stack = null;
if (DEV && tracing_mode_flag) {
stack = get_stack('CreatedAt');
}
// if non-proxyable, or is already a proxy, return `value`
if (typeof value !== 'object' || value === null || STATE_SYMBOL in value) {
return value;
@ -46,6 +41,8 @@ export function proxy(value, parent = null, prev) {
var is_proxied_array = is_array(value);
var version = source(0);
var stack = DEV && tracing_mode_flag ? get_stack('CreatedAt') : null;
if (is_proxied_array) {
// We need to create the length source eagerly to ensure that
// mutations to the array are properly synced with our proxy

Loading…
Cancel
Save