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
debouncesearchuxperformance
Debounce search input around 150-300ms, not a full second
A one-second debounce on a search field feels broken to users. Target 150-300ms so results feel responsive while still throttling requests.
PR: hegnar-components · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codets
| 1 | debounceTimeout.current = setTimeout(() => { |
| 2 | setSearchValue(value); |
| 3 | }, 1000); // 1s feels laggy |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | debounceTimeout.current = setTimeout(() => { |
| 2 | setSearchValue(value); |
| 3 | }, 200); // 150-300ms keeps search responsive |
Explanation (EN)
Objašnjenje (HR)