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

fix(component-store): move isInitialized check to queueScheduler context on state update #3492

Conversation

markostanimirovic
Copy link
Member

@markostanimirovic markostanimirovic commented Jul 16, 2022

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Closes #2991

What is the new behavior?

There is no initialization error when ComponentStore initialization and state update are scheduled via queueScheduler.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

@netlify
Copy link

netlify bot commented Jul 16, 2022

Deploy Preview for ngrx-io canceled.

Built without sensitive environment variables

Name Link
🔨 Latest commit d997c1c
🔍 Latest deploy log https://app.netlify.com/sites/ngrx-io/deploys/62fc19b40f29f900097e50ad

Comment on lines +243 to +249
expect(() => {
queueScheduler.schedule(() => {
const componentStore = new ComponentStore({ foo: false });
componentStore.patchState({ foo: true });
});
}).not.toThrow();
Copy link
Member Author

Choose a reason for hiding this comment

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

this test would fail before this PR

@markostanimirovic markostanimirovic force-pushed the fix/component-store/queue-scheduler branch from cc47494 to d997c1c Compare August 16, 2022 22:26
@markostanimirovic markostanimirovic marked this pull request as ready for review August 16, 2022 22:28
throwError(() => new Error(this.notInitializedErrorMessage))
),
// Push the value into queueScheduler
observeOn(queueScheduler),
Copy link
Member

Choose a reason for hiding this comment

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

I was very confident that observeOn was deprecated in favour of scheduled. Apparently I was dreaming?

Copy link
Member Author

@markostanimirovic markostanimirovic Aug 17, 2022

Choose a reason for hiding this comment

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

😁 AFAIK, the signature of the of function that accepts scheduler is deprecated in favor of scheduled.

@timdeschryver timdeschryver merged commit 53636e4 into ngrx:master Aug 17, 2022
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.

Clarify/improve existing behavior in component-store initState method
3 participants