Skip to content

Conversation

@jezweb
Copy link

@jezweb jezweb commented Nov 8, 2025

Problem

The updateTodoAction was missing proper handling for Next.js redirect errors. When redirect() is called from a server action, it throws a special error with message "NEXT_REDIRECT" that should be re-thrown unchanged to allow the redirect to complete properly.

Without this handling, redirect errors would:

  • Be logged as errors in the console (false alarm)
  • Potentially be wrapped in generic error messages
  • Cause confusion during debugging

Solution

Add NEXT_REDIRECT error handling to match the pattern already used in createTodoAction.

Changes

  • src/modules/todos/actions/update-todo.action.ts:
    • Check if error message is 'NEXT_REDIRECT' before error logging
    • Re-throw NEXT_REDIRECT errors unchanged
    • Prevents false error logs for successful operations

Pattern Consistency

This fix brings updateTodoAction in line with createTodoAction which already has this handling:

// Handle Next.js redirect errors - these are not actual errors
if (error instanceof Error && error.message === "NEXT_REDIRECT") {
    throw error; // Re-throw redirect errors as-is
}

🤖 Generated with Claude Code

Add proper handling for Next.js redirect errors in updateTodoAction to match the pattern used in createTodoAction. Without this, redirect() calls from server actions could be incorrectly logged as errors.

Changes:
- Check if error message is 'NEXT_REDIRECT' before error logging
- Re-throw NEXT_REDIRECT errors unchanged to allow proper redirection
- Prevents false error logs in console for successful operations

This matches the existing pattern in create-todo.action.ts for consistency.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Nov 8, 2025

Warning

Rate limit exceeded

@jezweb has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 8 minutes and 39 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between a44687a and ba9b4fc.

📒 Files selected for processing (1)
  • src/modules/todos/actions/update-todo.action.ts (1 hunks)
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

jezweb pushed a commit to jezweb/full-flare-stack that referenced this pull request Nov 8, 2025
jezweb pushed a commit to jezweb/full-flare-stack that referenced this pull request Nov 8, 2025
- Filter out NEXT_REDIRECT errors in toast.promise error handler
- NEXT_REDIRECT is Next.js flow control, not an actual error
- Fixes interaction issue between PR ifindev#19 and PR ifindev#23
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.

1 participant