pull/17805/head
Rich Harris 6 months ago
parent 14530ffba3
commit 2486d89404

@ -22,6 +22,7 @@ import { DESTROYED, LEGACY_PROPS, STATE_SYMBOL } from '#client/constants';
import { proxy } from '../proxy.js';
import { capture_store_binding } from './store.js';
import { legacy_mode_flag } from '../../flags/index.js';
import { effect, render_effect } from './effects.js';
/**
* @param {((value?: number) => number)} fn
@ -296,7 +297,7 @@ export function prop(props, key, flags, fallback) {
};
/** @type {((v: V) => void) | undefined} */
var setter;
let setter;
if (bindable) {
// Can be the case when someone does `mount(Component, props)` with `let props = $state({...})`
@ -308,6 +309,7 @@ export function prop(props, key, flags, fallback) {
(is_entry_props && key in props ? (v) => (props[key] = v) : undefined);
}
/** @type {V} */
var initial_value;
var is_store_sub = false;
@ -322,7 +324,11 @@ export function prop(props, key, flags, fallback) {
if (setter) {
if (runes) e.props_invalid_value(key);
setter(initial_value);
effect(() => {
untrack(() => {
setter(initial_value);
});
});
}
}

Loading…
Cancel
Save