Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
frontend ruleP1universalStack: react
reactasyncuxerror-handling
Reset dialog/modal open state on every terminal path
A modal opened before an async action must be explicitly closed (or kept open with an inline error) on both success and failure, not left depending on an unmount.
PR: vinify-frontend · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codetsx
| 1 | setDialogOpen(true); |
| 2 | try { await submit(); } // success only closes via parent unmount |
| 3 | catch { showError(); } // dialog stays open with a resolved spinner |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | setDialogOpen(true); |
| 2 | try { await submit(); setDialogOpen(false); } |
| 3 | catch (error) { showError(error); /* keep open, show inline error */ } |
Explanation (EN)
Objašnjenje (HR)