Repository navigation
fix(insights): silence navigation-cancellation toast - #70
Merged
Merged
Conversation
Closes #40. When the user navigates away from /dashboard/insights while loadData is still in flight, Next.js surfaces an "unexpected response from the server" error from the aborted stream. The destination page renders fine, but the red toast scares users into thinking something broke. Guard the catch branch with a case-insensitive match on "unexpected response" and route those to console.debug instead of toast. Real errors (5xx, malformed payload) still surface normally. Case-insensitive matching is deliberate so a minor wording change in a future Next.js version doesn't reopen the issue.
Merged
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #40.
When the user navigates away from
/dashboard/insightswhileloadDatais still in flight, Next.js surfaces an"An unexpected response was received from the server"error from the aborted stream. The destination page renders fine — the toast is purely cosmetic noise, but it scares users into thinking something broke.The
catchblock ofloadDatanow guards on a case-insensitive match of"unexpected response"and routes that one specific error toconsole.debuginstead oftoast.error. Real errors (5xx, malformed payload, etc.) still surface as toasts. The silent-refresh branch is untouched.Case-insensitive matching is deliberate so a minor wording change in a future Next.js version doesn't reopen the issue.
Test plan
/dashboard/insightscold (no cache), click a sidebar link while spinners are still showing → no red toast/dashboard/insights→ a real error toast still appears (we only suppress one specific string, not all errors)console.warninstead of toasting