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 ruleP1stack specificStack: Next.js/Redux
reduxroutingnextjsseparation-of-concerns
Don't perform navigation from inside state/redux actions
Leave routing to the framework's router/components; pushing routes from inside a redux action or reducer interferes with framework-managed navigation.
PR: vinify-frontend · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | export const logout = () => async (dispatch) => { |
| 2 | dispatch({ type: LOGOUT }); |
| 3 | Router.push('/'); |
| 4 | }; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | export const logout = () => async (dispatch) => { |
| 2 | dispatch({ type: LOGOUT }); |
| 3 | }; |
| 4 | // navigate in the component via useRouter after dispatch |
Explanation (EN)
Objašnjenje (HR)