-
Notifications
You must be signed in to change notification settings - Fork 31
Fixing stray error message in expression validation #3916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughTwo changes address validation message handling: the validation schema now references shared string definitions for the message property instead of primitive types, and FormDataWrite's path resolution logic removes a fallback that returned the base reference field when no matching paths exist. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
schemas/json/validation/validation.schema.v1.json(1 hunks)src/features/formData/FormDataWrite.tsx(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Avoid usinganytype or type casting (as type) in TypeScript code; improve typing by avoiding casts andanys when refactoring
Use objects for managing query keys and functions, andqueryOptionsfor sharing TanStack Query patterns across the system for central management
Files:
src/features/formData/FormDataWrite.tsx
{**/*.module.css,**/*.{ts,tsx}}
📄 CodeRabbit inference engine (CLAUDE.md)
Use CSS Modules for component styling and leverage Digdir Design System components when possible
Files:
src/features/formData/FormDataWrite.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Install
- GitHub Check: Install
- GitHub Check: Type-checks, eslint, unit tests and SonarCloud
- GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
src/features/formData/FormDataWrite.tsx (1)
855-855: LGTM! This fixes the stray error message issue.Returning an empty array when no matching paths are found (instead of the previous fallback to
[reference.field]) correctly prevents validation expressions from attempting to evaluate non-existent paths in repeating groups. This directly addresses issue #16885 where stray errors appeared in DevTools when validating empty fields that reference repeating group elements on different pages.
|



Description
When a repeating group exists, but there are no rows, expression validation ran even though there were no valid data model paths for it to run on. This caused an error to be logged in devtools. When adding a row everything worked as expected.
To be sure the code I removed wasn't actually needed (I added it in #3735), I made a test-script and inspected this manually in all apps it could have affected. The way I see it, this should not have any detrimental effects.
Related Issue(s)
Verification/QA
kind/*andbackport*label to this PR for proper release notes grouping