Skip to content

Commit 0ef587a

Browse files
committed
explanatory comment
1 parent 3933328 commit 0ef587a

File tree

1 file changed

+9
-1
lines changed
  • packages/svelte/src/internal/client/reactivity

1 file changed

+9
-1
lines changed

packages/svelte/src/internal/client/reactivity/props.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,15 @@ export function prop(props, key, flags, fallback) {
322322
} else {
323323
getter = () => {
324324
var value = /** @type {V} */ (props[key]);
325-
if (value !== undefined) fallback_value = /** @type {V} */ (undefined);
325+
326+
if (value !== undefined) {
327+
// in legacy mode, we don't revert to the fallback value
328+
// if the prop goes from defined to undefined. The easiest
329+
// way to model this is to make the fallback undefined
330+
// as soon as the prop has a value
331+
fallback_value = /** @type {V} */ (undefined);
332+
}
333+
326334
return value === undefined ? fallback_value : value;
327335
};
328336
}

0 commit comments

Comments
 (0)