Skip to content

Svelte 5: Improve the Non-bound props cannot be mutated error #9880

@AdrianGonz97

Description

@AdrianGonz97

Describe the bug

If a prop (object in the provided REPL's case) that is not bound too is mutated inside of the component, we get the following error:

Uncaught Error: Non-bound props cannot be mutated — use `bind:<prop>={...}` to make `count` settable. Fallback values can never be mutated.

Setting aside that the last sentence of the error doesn't apply in this case, it would be preferable if the error also printed the problematic prop that needs to be bound, rather than just the property that's being mutated.

One could imagine if the object was more complex or if the consumer didn't have access the to implementation details of the component (i.e. imported from a library), that it would be more difficult to track down the issue when given the current error message.

Reproduction

REPL

Logs

No response

System Info

n/a

Severity

annoyance

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions