-
Notifications
You must be signed in to change notification settings - Fork 995
Resolved Edit resource category form and charge item definition edit form bug #15099
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: develop
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for care-ohc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
WalkthroughConsolidates ResourceCategoryForm initialization into one effect triggered when the sheet opens (handles create vs edit) and updates slug sanitization handlers in three forms to set the slug field as dirty so validation and dirty state propagate on edits. Changes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (13)**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursorrules)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (.cursorrules)
Files:
**/*.{tsx,jsx}📄 CodeRabbit inference engine (.cursorrules)
Files:
src/**/*.{ts,tsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
src/**/*{[Ff]orm,[Ii]nput,[Ff]ield}*.{ts,tsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
src/components/**/*.{ts,tsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
src/**/*.{ts,tsx,css}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
src/**/*.{tsx,ts}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
src/**/*.{tsx,css}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/*📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.tsx📄 CodeRabbit inference engine (.cursor/rules/02-coding-standards.mdc)
Files:
**/*.{tsx,ts}📄 CodeRabbit inference engine (.cursor/rules/04-ui-components.mdc)
Files:
**/*.{ts,tsx,js,jsx,json,css,scss,html}📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (12)📚 Learning: 2025-11-25T13:50:46.407ZApplied to files:
📚 Learning: 2025-11-25T13:51:23.408ZApplied to files:
📚 Learning: 2024-11-20T19:08:38.025ZApplied to files:
📚 Learning: 2025-03-30T12:22:58.576ZApplied to files:
📚 Learning: 2025-04-13T03:41:38.805ZApplied to files:
📚 Learning: 2024-11-25T09:21:37.265ZApplied to files:
📚 Learning: 2024-12-11T01:32:56.923ZApplied to files:
📚 Learning: 2025-04-13T03:41:38.805ZApplied to files:
📚 Learning: 2025-08-22T14:24:18.226ZApplied to files:
📚 Learning: 2025-11-25T13:53:40.623ZApplied to files:
📚 Learning: 2025-12-17T19:47:58.152ZApplied to files:
📚 Learning: 2025-12-22T10:16:36.690ZApplied to files:
⏰ 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)
🔇 Additional comments (2)
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 |
🚀 Preview Deployment Ready!
This preview will be automatically updated when you push new commits to this PR. |
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.
Pull request overview
This pull request resolves form state management issues in resource category, charge item definition, and product knowledge forms. The changes fix a bug where the Update button was not enabled when editing slug values, and consolidates useEffect logic to prevent race conditions during form resets.
Changes:
- Added
shouldDirty: trueflag to slug fieldsetValuecalls across all three forms to properly track manual edits - Consolidated two separate useEffects in ResourceCategoryForm into a single effect that handles both create and edit modes based on the
isOpenstate
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/components/Common/ResourceCategoryForm.tsx | Merged two useEffects into one to eliminate race condition on form reset; added shouldDirty: true to slug input onChange handler |
| src/pages/Facility/settings/chargeItemDefinitions/ChargeItemDefinitionForm.tsx | Added shouldDirty: true to slug input onChange handler to enable Update button on manual edits |
| src/pages/Facility/settings/productKnowledge/ProductKnowledgeForm.tsx | Added shouldDirty: true to slug input onChange handler to enable Update button on manual edits |
🎭 Playwright Test ResultsStatus: ✅ Passed
📊 Detailed results are available in the playwright-final-report artifact. Run: #4553 |
| } else if (!isEditing) { | ||
| // Create mode: reset to empty defaults |
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.
| } else if (!isEditing) { | |
| // Create mode: reset to empty defaults | |
| } else { |
| if (!isOpen) return; | ||
|
|
||
| if (isEditing && categoryData) { | ||
| // Edit mode: populate form with existing data |
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.
| // Edit mode: populate form with existing data |
Proposed Changes
Fixes #15068
Recording.2026-01-12.003029.mp4
Tagging: @ohcnetwork/care-fe-code-reviewers
Merge Checklist
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.