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
feature-flagsuxcorrectnessconditional-rendering
Gate an action button behind the same condition that enables its destination
A button that navigates to a feature must be hidden when that feature is disabled, otherwise clicking it leads nowhere.
PR: hegnar-journalist-boost · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codetsx
| 1 | {article && <button onClick={openChat}>Refine with chat</button>} |
| 2 | // shown even when chat panel is disabled |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | {article && isChatPanelEnabled && ( |
| 2 | <button onClick={openChat}>Refine with chat</button> |
| 3 | )} |
Explanation (EN)
Objašnjenje (HR)