Skip to content

refactor: ensure data as readonly when possible - #382

Open
federicobozzini wants to merge 3 commits into
mainfrom
view-readonly-model-data
Open

refactor: ensure data as readonly when possible#382
federicobozzini wants to merge 3 commits into
mainfrom
view-readonly-model-data

Conversation

@federicobozzini

Copy link
Copy Markdown
Collaborator

Changes

  • make sure views always use readonly model data
  • ts target updated to es2023. This is compatible with VS code 101

Screenshots

Signed-off-by: Federico Bozzini <federico.bozzini@arm.com>
@federicobozzini
federicobozzini requested a review from a team as a code owner July 24, 2026 15:24
@github-actions github-actions Bot added the refactor Refactor change excluded from release notes label Jul 24, 2026

@awphi awphi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sensible on its own but I wonder if we should make this even stricter and have the model return readonly values rather than claiming immutability for a handful of values halfway through the view layer.


Also think we should enforce this for objects too via Readonly (will need to write a recursive type to make it deep). Wondering if we could hoist all this up and just define loadables as, say

export type Loaded<T> = DeepReadonly<{ status: 'loaded'; data: T; loading: boolean }>;

Because you should never mutate any part of a loadable after its created? I think that's a safe assertion to make?

Signed-off-by: Federico Bozzini <federico.bozzini@arm.com>
@federicobozzini federicobozzini changed the title refactor: ensure views only access model data as readonly refactor: ensure data as readonly when possible Jul 27, 2026
@federicobozzini

Copy link
Copy Markdown
Collaborator Author

@awphi I've introduced a fairly aggressive DeepReadOnly usage af79306

WDYT?

I'm afraid it would be better but it might be hard to be consistent with this over time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Refactor change excluded from release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants