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

feat(store): change dispatchDataToStore return type to void #408

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ekincia
Copy link
Contributor

@ekincia ekincia commented Feb 9, 2025

Description

Requirements

  • Correct label have been assigned
  • Project has been assigned
  • Milestone has been (created/)assigned

- Update dispatchDataToStore to return Observable<void> instead of Observable<DataType>
- resolves #104

BREAKING CHANGE: dispatchDataToStore now returns Observable<void> instead of
Observable<DataType>. This change enforces SSOT (Single Source of Truth) principle
by requiring users to explicitly subscribe to store selectors to get data.

To migrate:
Before:
dispatchDataToStore(actions, data$, store)
  .pipe(map(data => data.someProperty))

After:
dispatchDataToStore(actions, data$, store)
  .pipe(switchMap(() => store.select(selector)))
- Update store-service.ts to use switchMap after dispatchDataToStore
- Update store-state.service.ts to use switchMap after dispatchDataToStore
- Fix typo in implementation docs
- Update example in implementation docs to show proper SSOT usage

BREAKING CHANGE: dispatchDataToStore now requires switchMap to store
selectors to maintain Single Source of Truth principle
@ekincia ekincia added enhancement New feature or request ngx-store @studiohyperdrive/ngx-store labels Feb 9, 2025
@ekincia ekincia added this to the ngx-store:v20.0.0 milestone Feb 9, 2025
@ekincia ekincia self-assigned this Feb 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ngx-store @studiohyperdrive/ngx-store
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ngx-store: displatchDataToStore should not return
2 participants