Repository navigation
fix(metadata): inline value edits not persisted to backend - #16655
Conversation
📝 WalkthroughWalkthroughThis PR updates the metadata value editing flow to require a string ChangesMetadata Value Edit Flow
Estimated code review effort: 2 (Simple) | ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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.
🧹 Nitpick comments (2)
web/src/pages/dataset/components/metedata/manage-modal-column.tsx (2)
16-16: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider extracting a shared type for
addUpdateValue.The
addUpdateValuecallback shape is duplicated here and inIManageValuesProps(interface.ts). Keeping them independently in sync is exactly how the previous optional/requiredoriginalValuemismatch could recur.♻️ Suggested extraction
+// in interface.ts +export type AddUpdateValueFn = ( + key: string, + originalValue: string, + newValue: string | string[], + type?: MetadataValueType, +) => void;- addUpdateValue: ( - key: string, - originalValue: string, - newValue: string | string[], - type?: MetadataValueType, - ) => void; + addUpdateValue: AddUpdateValueFn;Also applies to: 28-34
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/src/pages/dataset/components/metedata/manage-modal-column.tsx` at line 16, The addUpdateValue callback shape is duplicated between manage-modal-column.tsx and IManageValuesProps in interface.ts, which can drift again. Extract a shared type for addUpdateValue into the common interface module, then import and reuse that type in both the ManageModalColumn component and IManageValuesProps so the originalValue contract stays identical everywhere.
97-109: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winUnconditional
setShouldSave(true)still triggers a save even when nothing changed.The new equality check correctly skips
addUpdateValuefor no-op edits, butsetShouldSave(true)still fires unconditionally right after, causing an unnecessary save request whenever a user clicks a value chip and blurs without editing.♻️ Proposed fix
if (realValue.value !== realValue.newValue) { addUpdateValue( realValue.field, realValue.value, realValue.newValue, realValue.valueType, ); + setShouldSave(true); } setEditingValue(null); - setShouldSave(true); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/src/pages/dataset/components/metedata/manage-modal-column.tsx` around lines 97 - 109, The no-op edit path in the edit handler still marks the table as dirty because setShouldSave(true) runs unconditionally in manage-modal-column.tsx. Update the handler around the realValue.value / realValue.newValue check so setShouldSave(true) only runs when addUpdateValue is called for an actual change, while still clearing editing state in all cases. Keep the logic localized to the callback that uses addUpdateValue, setEditingValue, and setShouldSave.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@web/src/pages/dataset/components/metedata/manage-modal-column.tsx`:
- Line 16: The addUpdateValue callback shape is duplicated between
manage-modal-column.tsx and IManageValuesProps in interface.ts, which can drift
again. Extract a shared type for addUpdateValue into the common interface
module, then import and reuse that type in both the ManageModalColumn component
and IManageValuesProps so the originalValue contract stays identical everywhere.
- Around line 97-109: The no-op edit path in the edit handler still marks the
table as dirty because setShouldSave(true) runs unconditionally in
manage-modal-column.tsx. Update the handler around the realValue.value /
realValue.newValue check so setShouldSave(true) only runs when addUpdateValue is
called for an actual change, while still clearing editing state in all cases.
Keep the logic localized to the callback that uses addUpdateValue,
setEditingValue, and setShouldSave.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c9a3d815-3861-4344-b715-1a2e7667a51e
📒 Files selected for processing (4)
web/src/pages/dataset/components/metedata/hooks/use-manage-values-modal.tsweb/src/pages/dataset/components/metedata/interface.tsweb/src/pages/dataset/components/metedata/manage-modal-column.tsxweb/src/pages/dataset/components/metedata/manage-modal.tsx
Summary
fix(metadata): inline value edits not persisted to backend