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 ruleP2universalStack: react
propsmodesclarityforms
Branch create vs edit modes explicitly instead of patching props
When a dialog serves both create and edit, pass different inputs per mode (e.g. no existing items for create) rather than working around shared props.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codetsx
| 1 | <Dialog userWatchlist={userWatchlist} /> // edit data leaks into create flow |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | <Dialog userWatchlist={editMode ? userWatchlist : null} isWatchlistEmpty={editMode ? !count : true} /> |
Explanation (EN)
Objašnjenje (HR)