fix: Fix invalid blocker state transition in UnsavedChangesProvider (#1184)#1187
Conversation
Fix #1184: Time Unit error caused by invalid blocker state transition. The error 'Invalid blocker state transition: unblocked -> proceeding' occurred when calling blocker.proceed() in UnsavedChangesProvider. Root cause: setDirty(false) was called before blocker.proceed?.(), which triggered a re-render that could change the blocker state before proceed was called. This caused React Router's internal state machine to receive a proceed call when the blocker was no longer in the 'blocked' state. Fix: - Call blocker.proceed?.() before setDirty(false) in handleConfirm - Add additional state check in isSamePathNavigation useEffect to ensure blocker is still 'blocked' before calling proceed() Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
|
@copilot Please review this pull request. |
Here's my review of this PR: SummaryThe fix correctly addresses the root cause of the Change 1 —
|
|
@copilot Please review this pull request. |
The PR is in good shape. Here's the updated review reflecting both commits: Current state of changesCommit 1 ( The code is now correct and clean: // handleConfirm — correct order
blocker.proceed?.() // called while blocker is still 'blocked'
setDirty(false) // safe to update state after proceed
// isSamePathNavigation useEffect — clean, no redundancy
if (isSamePathNavigation && proceed) {
proceed()
}No issues found. The fix is minimal and correctly addresses the root cause of the |
Fix #1184: Time Unit error caused by invalid blocker state transition.
Root Cause:
setDirty(false) was called before blocker.proceed?.() in UnsavedChangesProvider, which triggered a re-render that changed the blocker state before proceed was called. This caused React Router's internal state machine to receive a proceed call when the blocker was no longer in the 'blocked' state.
Error:
Fix:
Testing: