fix(inject-route-fragment): return default values even when falsy - #697
Conversation
|
View your CI Pipeline Execution ↗ for commit caaf293
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Code Review
This pull request fixes an issue in injectRouteFragment where falsy default values (such as 0) were ignored and fell back to null by changing the check to verify if defaultValue is not undefined. A test case was added to verify this behavior. The reviewer noted a type safety issue in the test component where providing a numeric default value without a parser could lead to a runtime type mismatch if a string fragment is present, and suggested using a parser like numberAttribute.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
defaultValue used a truthy check, so falsy defaults (0, '', false) were silently discarded and
nullwas returned instead.