Open gilberto-torrezan opened 3 years ago
Initially this change was meant to be the new default in V22 projects, but after some rounds of internal testing, the feedback was that it gets more in the way than it helps, especially when using MobX for state management. It would also create unnecessary friction for developers migrating from V21.
So we won't be pushing this for V22, but consider it as an option (not the default) for V23.
It's recommended and considered a best practice to avoid mutating data received from the endpoints. This is a breaking change that will introduce the
readonly
flag andReadonlyArray
to the attributes of generated data structures.With this change, applications written in Fusion will be safer by design.
Refer to this ticket with more technical details.
Use cases
As a developer, when consuming data from a Fusion endpoint and cascading the data over the application, you are safe to know that the received data is immutable, no matter the logic in your application. It needs to be a conscious decision from the developer to create a mutable clone of the data if needed.
Acceptance criteria
Documentation:
https://vaadin.com/docs/latest/fusion/application/accessing-backend/#read-only-access
How to test?