-
Notifications
You must be signed in to change notification settings - Fork 403
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): debounce selectSignal
by default
#2190
Conversation
In this commit, we make `selectSignal` debouncable by default. This means that changes originating from the state stream will not immediately update the signal but will instead occur as soon as possible (in the next microtask tick). By decoupling state signal updates from synchronous changes, we adhere to constraints on updates within effects. There are situations where actions dispatched within effects are synchronous, causing the state signal to also receive synchronous updates. This scenario can lead to an error indicating that signal writes are not permitted within effects.
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 18f8ede. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 4 targetsSent with 💌 from NxCloud. |
BundleMon (Integration Projects)Files updated (2)
Total files change +330B +0.23% Final result: ✅ View report in BundleMon website ➡️ |
79249d4
to
929f08a
Compare
929f08a
to
c7977ba
Compare
} catch { | ||
return toSignal(observable, { initialValue, injector: this._injector }); | ||
} | ||
return toSignal(observable, { initialValue }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh nice, so this is able to determine the correct injection context at run time🎉.
Code Climate has analyzed commit 18f8ede and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 92.3% (50% is the threshold). This pull request will bring the total coverage in the repository to 95.4% (0.0% change). View more on Code Climate. |
@arturovt @markwhitfeld This is causing issues when using accessing signals inside dispatch. the signal value becomes null. Mostly when the default is null and values are set by an API call.
|
In this commit, we make
selectSignal
debouncable by default. This means that changes originating from the state stream will not immediately update the signal but will instead occur as soon as possible (in the next microtask tick). By decoupling state signal updates from synchronous changes, we adhere to constraints on updates within effects. There are situations where actions dispatched within effects are synchronous, causing the state signal to also receive synchronous updates. This scenario can lead to an error indicating that signal writes are not permitted within effects.Resolves #2180