Skip to content

Fix Redux Error #9: Nested dispatch in authSlice - #39

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/redux-error-9-authslice
Open

Fix Redux Error #9: Nested dispatch in authSlice#39
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/redux-error-9-authslice

Conversation

@sentry

@sentry sentry Bot commented Jul 19, 2026

Copy link
Copy Markdown

This PR resolves Redux Error #9, which occurs when an action is dispatched while a reducer is already executing. The root cause was identified in src/store/slices/authSlice.ts where the setCredentials reducer synchronously called userLogin$.next({}).

This synchronous emission triggered a chain of events via the userLogin$ observable's subscription in src/init.ts, leading to oneSignalActionBasedOnStatus() and subsequently setShowOneSignalPrompt being dispatched while the setCredentials reducer was still active.

The fix involves wrapping userLogin$.next({}) in a setTimeout(() => ..., 0) call within the setCredentials reducer. This defers the observable emission to the next event loop tick, ensuring that the Redux reducer has completed its execution before any downstream dispatches are triggered, thus preventing the nested dispatch error.

Fixes SH-STUDENT-APP-E

@netlify

netlify Bot commented Jul 19, 2026

Copy link
Copy Markdown

Deploy Preview for studenthub-student ready!

Name Link
🔨 Latest commit e8fe2d5
🔍 Latest deploy log https://app.netlify.com/projects/studenthub-student/deploys/6a5d57eda1e2e1000864bb24
😎 Deploy Preview https://deploy-preview-39--studenthub-student.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

0 participants