deprecate immutable

proxied-state-each-blocks
Rich Harris 7 months ago
parent 95fa5ec66f
commit 78ae50a68f

@ -72,7 +72,10 @@ export const validate_component_options =
discloseVersion: boolean(true),
immutable: boolean(false),
immutable: deprecate(
'The immutable option has been deprecated. It has no effect in runes mode.',
boolean(false)
),
legacy: object({
componentApi: boolean(false)
@ -166,6 +169,18 @@ function warn_removed(message) {
};
}
/**
* @param {string} message
* @param {Validator} validator
* @returns {Validator}
*/
function deprecate(message, validator) {
return (input, keypath) => {
if (input !== undefined) warn(message);
return validator(input, keypath);
};
}
/**
* @param {Record<string, Validator>} children
* @param {boolean} [allow_unknown]

@ -39,3 +39,7 @@ These functions run indiscriminately when _anything_ changes. By using `$effect.
```
Note that using `$effect` and `$effect.pre` will put you in [runes mode](/docs/runes) — be sure to update your props and state accordingly.
## `immutable`
The `immutable` compiler option is deprecated. Use runes mode instead, where all state is immutable (which means that assigning to `object.property` won't cause updates for anything that is observing `object` itself, or a different property of it).

Loading…
Cancel
Save