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

Refactor to use StoreService instead of Store #677

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

Dassderdie
Copy link
Collaborator

@Dassderdie Dassderdie commented Feb 18, 2023

  • There is now a StoreService that wraps the ngrx-store
  • This improves the readability and especially discoverability of synchronous access to the store (storeService.select(selector) instead of getStateSnapshot(selector, store))
  • It is now possible to add comments to the store functions (like that we usually don't dispatch actions but propose them via the exerciseService)
  • Previously, one always had to import Store<AppState> to get the typings - now StoreService is enough
  • Makes it easier to replace ngrx should the need arise as we only use a very small feature set of it

Nearly all of the changes are just straightforward renaming.

@Dassderdie Dassderdie self-assigned this Feb 18, 2023
@Dassderdie Dassderdie marked this pull request as ready for review February 18, 2023 18:21
Copy link
Contributor

@benn02 benn02 left a comment

Choose a reason for hiding this comment

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

LGTM, but this still has conflicts to be resolved. Please resolve them for approval.

Comment on lines +28 to +32
this.currentLeader = this.assignLeaderBehaviorState.leaderId
? this.storeService.select$(
createSelectPersonnel(this.assignLeaderBehaviorState.leaderId)
)
: undefined;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I believe I fixed a potential bug here:
If the leaderId would have changed back from an id to undefined, the component would still have displayed the previous leader.

@Dassderdie Dassderdie requested a review from benn02 March 18, 2023 17:55
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.

2 participants