Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Use immer for extension state #107

Merged
merged 2 commits into from
Nov 21, 2024
Merged

Conversation

rszwajko
Copy link
Contributor

@rszwajko rszwajko commented Nov 20, 2024

Depends on #103

Concentrate data state in the extension object as state.data and enforce top-down propagation of changes.
Key points:

  1. state is made immutable using Immer - reference comparison can be used to detect changes
  2. components interested in receiving notifications about state change should add callbacks via onDidChangeData
  3. by convention after initialization the state is modified only via commands

Related refactorings:

  1. track per-file solution state - LocalChange has now "state" prop with 3 values: pending,applied,discarded
  2. use onDidChangeData to trigger file model actions (content of the native Konveyor Resolution view) and in-memory FS actions (suggestion diffs applied to current code)

@rszwajko rszwajko changed the title :Sparkles: Use immer for extension state ✨ Use immer for extension state Nov 20, 2024
@sjd78
Copy link
Member

sjd78 commented Nov 21, 2024

I forget how clean the producers make changing the data look!

@rszwajko rszwajko force-pushed the liftState branch 2 times, most recently from 8178a44 to b401ee6 Compare November 21, 2024 21:01
Concentrate data state in the extension object as state.data and
enforce top-down propagation of changes.
Key points:
1. state is made immutable using Immer - reference comparison can be
   used to detect changes
2. components interested in receiving notifications about state change
   should add callbacks via onDidChangeData
3. by convention after initialization the state is modified only
   via commands

Related refactorings:
1. track per-file solution state - LocalChange has now "state" prop
   with 3 values: pending,applied,discarded
2. use onDidChangeData to trigger file model actions (content of the
   native Konveyor Resolution view) and in-memory FS actions
   (suggestion diffs applied to current code)

Signed-off-by: Radoslaw Szwajkowski <[email protected]>
@rszwajko rszwajko marked this pull request as ready for review November 21, 2024 21:09
@rszwajko rszwajko requested a review from a team as a code owner November 21, 2024 21:09
@rszwajko rszwajko merged commit 69e3864 into konveyor:main Nov 21, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants