-
Notifications
You must be signed in to change notification settings - Fork 567
remove useless ref_id in Personal Data form #3109
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?
remove useless ref_id in Personal Data form #3109
Conversation
📝 WalkthroughWalkthroughThe changes modify the ref_id field behavior across form and schema layers. A conditional hidden attribute hides the ref_id TextField when undefined, and the schema removes the default empty string value, making the field return undefined instead of an empty string when omitted. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
⏰ 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). (7)
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: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
frontend/src/lib/utils/schemas.ts (1)
867-876: Critical: Commented-out field causes schema-form mismatch.Commenting out
ref_idremoves it from the schema entirely, butPersonalDataForm.sveltestill referencesfield="ref_id". This mismatch will cause form validation and submission to fail or ignore the field since it's not defined in the schema.If the goal is to remove
ref_idbecause the backend model doesn't support it, remove the correspondingTextFieldfromPersonalDataForm.svelte(lines 28-35) entirely instead of just hiding it. Alternatively, if backward compatibility is needed for existing records, keepref_id: z.string().optional()in the schema.🔎 Recommended fix: Remove the commented line
export const personalDataSchema = z.object({ ...NameDescriptionMixin, - // ref_id: z.string().optional().default(''), category: z.string(), retention: z.string(), deletion_policy: z.string(), is_sensitive: z.boolean().optional(), processing: z.string(), assets: z.string().uuid().optional().array().optional() });And remove the TextField in PersonalDataForm.svelte (see separate comment).
frontend/src/lib/components/Forms/ModelForm/PersonalDataForm.svelte (1)
28-35: Critical: Form field references non-existent schema field.This
TextFieldreferencesfield="ref_id", butpersonalDataSchemano longer definesref_id(it's commented out inschemas.tsline 869). This will cause form validation and submission issues because superforms requires fields to be defined in the schema.Given the PR objective to "remove useless ref_id," this entire
TextFieldcomponent should be removed rather than conditionally hidden. The hidden logichidden={!initialData.ref_id}won't work as intended since the field can't be validated or submitted without being in the schema.🔎 Recommended fix: Remove the TextField entirely
-<TextField - {form} - field="ref_id" - label={m.refId()} - cacheLock={cacheLocks['ref_id']} - bind:cachedValue={formDataCache['ref_id']} - hidden={!initialData.ref_id} -/> <AutocompleteSelect {form} field="category"
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
frontend/src/lib/components/Forms/ModelForm/PersonalDataForm.sveltefrontend/src/lib/utils/schemas.ts
⏰ 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). (7)
- GitHub Check: enterprise-startup-functional-test (3.12)
- GitHub Check: startup-functional-test (3.12)
- GitHub Check: build_enterprise_frontend
- GitHub Check: enterprise-startup-docker-compose-test
- GitHub Check: startup-docker-compose-test
- GitHub Check: build_community_frontend
- GitHub Check: Analyze (python)
nas-tabchiche
left a 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.
Let's just delete the ref_id field in PersonalDataForm.svelte and its associated schema instead of hiding/commenting it out.
Personal data form was having an ID field but the model lacks a matching ref_id field
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.