Skip to content

Fix: SH-STUDENT-APP-7 Redux error #9 - Reducers may not dispatch actions - #38

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/sh-student-app-7-redux-error
Open

Fix: SH-STUDENT-APP-7 Redux error #9 - Reducers may not dispatch actions#38
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/sh-student-app-7-redux-error

Conversation

@sentry

@sentry sentry Bot commented Jul 15, 2026

Copy link
Copy Markdown

This PR addresses issue SH-STUDENT-APP-7, which reported "Error: Minified Redux error #9; visit https://redux.js.org/Errors?code=9 for the full message or use the non-minified dev environment for full errors."

The root cause was identified as a violation of Redux's principle that reducers must be pure functions and not dispatch actions. Specifically, the userLogin$.next({}) call was made synchronously inside the setCredentials reducer in src/store/slices/authSlice.ts. This synchronous Subject emission triggered a subscription in src/init.ts that, in turn, synchronously dispatched setShowOneSignalPrompt while the setCredentials reducer was still executing, leading to Redux error #9.

Solution Implemented:

  1. Removed side-effect from reducer: The userLogin$.next({}) call was removed from the setCredentials reducer in src/store/slices/authSlice.ts.
  2. Created a Redux thunk: A new thunk, loginWithCredentials, was introduced in src/store/slices/authSlice.ts. This thunk first dispatches the setCredentials action and then, after the reducer has completed, calls userLogin$.next({}).
  3. Updated call sites: All occurrences where dispatch(setCredentials({ token })) was previously used have been updated to dispatch(loginWithCredentials(token)). This ensures the side-effect (the userLogin$ emission) occurs outside the reducer's execution cycle.

This change ensures that Redux reducers remain pure, preventing the synchronous dispatch of actions during a reducer's execution and resolving the reported error.

Fixes SH-STUDENT-APP-7

@netlify

netlify Bot commented Jul 15, 2026

Copy link
Copy Markdown

Deploy Preview for studenthub-student ready!

Name Link
🔨 Latest commit 1ea8799
🔍 Latest deploy log https://app.netlify.com/projects/studenthub-student/deploys/6a57698db412540008d1bad2
😎 Deploy Preview https://deploy-preview-38--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