Repository navigation
fix(client): dispatch error actions in settings sagas - #71754
venkatsammm wants to merge 2 commits into
Conversation
|
Hi there, Thanks for opening this pull request. The automated checks found some issues: Checklist: The PR description is missing the required checklist or some of its items are not completed:
Please edit your PR description to include the following template with the checklist items completed. Checklist:
<!-- Please follow this checklist and put an x in each of the boxes, like this: [x]. It will ensure that our team takes your pull request seriously. -->
- [ ] I have read and followed the [contribution guidelines](https://contribute.freecodecamp.org).
- [ ] I have read and followed the [how to open a pull request guide](https://contribute.freecodecamp.org/how-to-open-a-pull-request/).
- [ ] My pull request targets the `main` branch of freeCodeCamp.
- [ ] I have tested these changes either locally on my machine, or GitHub Codespaces.
<!--If your pull request closes a GitHub issue, replace the XXXXX below with the issue number.-->
Closes #XXXXX
<!-- Feel free to add any additional description of changes below this line -->Join us in our chat room or our forum if you have any questions or need help with contributing. |
|
Hi there, thank you for your interest in contributing. However, the linked issue hasn't been triaged yet, so I'm closing this PR to keep the queue manageable. Feel free to open a new PR once consensus has been reached and the issue is marked as ready for contribution. |
|
Thanks for covering all eleven affected handlers. Could you also add one integration regression test for a representative setting, such as updating socials? Dispatch the settings-update action through a Redux store with the application's middleware order (including thunk and saga) and the shared error saga. Mock the API call to reject with an
The test should fail with the original |
Checklist:
mainbranch of freeCodeCamp.Closes #71585
Summary
11
catchblocks inclient/src/redux/settings/settings-sagas.jsyielded theerror action creator instead of invoking it:
putwith a bare function reference never dispatches an error action, sofailed settings requests (socials, portfolio, keyboard shortcuts, etc.) failed
silently: no flash message, and Redux stayed out of sync with the server. The
global handler in
client/src/redux/error-saga.jsonly reacts to actions whosepayload is an error, so these failures were dropped entirely.
The regression was introduced by the unused-variable cleanup in 5ef9868, which
removed the unused
(e)parameter from thecatchclauses.Changes
yield put(xxxError(e)).settings-sagas.test.jscovering every affected saga withredux-saga-test-plan, asserting the invoked error action is yielded whenthe request (or the
storewrite) throws.Test plan
pnpm --filter @freecodecamp/client exec vitest run src/redux/settings— 12 tests pass (11 new).pnpm --filter @freecodecamp/client exec oxlint --deny-warningson both files — clean.prettier --checkon both files.Checklist:
mainbranch of freeCodeCamp.Closes #71585
Summary
11
catchblocks inclient/src/redux/settings/settings-sagas.jsyielded theerror action creator instead of invoking it:
putwith a bare function reference never dispatches an error action, sofailed settings requests (socials, portfolio, keyboard shortcuts, etc.) failed
silently: no flash message, and Redux stayed out of sync with the server. The
global handler in
client/src/redux/error-saga.jsonly reacts to actions whosepayload is an error, so these failures were dropped entirely.
The regression was introduced by the unused-variable cleanup in 5ef9868, which
removed the unused
(e)parameter from thecatchclauses.Changes
yield put(xxxError(e)).settings-sagas.test.jscovering every affected saga withredux-saga-test-plan, asserting the invoked error action is yielded whenthe request (or the
storewrite) throws.Test plan
pnpm --filter @freecodecamp/client exec vitest run src/redux/settings— 12 tests pass (11 new).pnpm --filter @freecodecamp/client exec oxlint --deny-warningson both files — clean.prettier --checkon both files.