Skip to content

fix(metadata): inline value edits not persisted to backend - #16655

Merged
wangq8 merged 1 commit into
infiniflow:mainfrom
dcc123456:fix/metadata-0706
Jul 6, 2026
Merged

wangq8 merged 1 commit into
infiniflow:mainfrom
dcc123456:fix/metadata-0706

Conversation

@dcc123456

Copy link
Copy Markdown
Collaborator

Summary

fix(metadata): inline value edits not persisted to backend

@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jul 6, 2026
@coderabbitai

coderabbitai Bot commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR updates the metadata value editing flow to require a string originalValue for addUpdateValue, threads valueType through the edit state in useMetadataColumns, wires addUpdateValue into ManageMetadataModal, and changes the add-value save path to pass an empty string instead of undefined.

Changes

Metadata Value Edit Flow

Layer / File(s) Summary
addUpdateValue contract and add-value save path
web/src/pages/dataset/components/metedata/interface.ts, web/src/pages/dataset/components/metedata/hooks/use-manage-values-modal.ts
originalValue in addUpdateValue is now a required string; add-value mode save now passes '' instead of undefined.
Metadata columns edit state and callback wiring
web/src/pages/dataset/components/metedata/manage-modal-column.tsx, web/src/pages/dataset/components/metedata/manage-modal.tsx
useMetadataColumns gains an addUpdateValue callback, tracks valueType in edit state, invokes addUpdateValue when a value changes in saveEditedValue, and the Edit button now passes valueType; ManageMetadataModal supplies addUpdateValue.

Estimated code review effort: 2 (Simple) | ~12 minutes

Possibly related PRs

  • infiniflow/ragflow#15229: Both PRs modify the useManageValues add-value-mode save path calling addUpdateValue with corrected parameters.

Poem

A rabbit hops through fields of type,
Turning "undefined" to strings just right,
With valueType tucked snug in tow,
Edits now save, click by click, row by row,
Hop-hop-hooray, the metadata's tight! 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main fix: inline metadata value edits were not reaching the backend.
Description check ✅ Passed The required Summary section is present and describes the fix, though it adds little background context.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dcc123456
dcc123456 requested a review from wangq8 July 6, 2026 03:46
@dcc123456 dcc123456 added 🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration labels Jul 6, 2026
@dcc123456
dcc123456 marked this pull request as draft July 6, 2026 03:46
@dcc123456
dcc123456 marked this pull request as ready for review July 6, 2026 03:46

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
web/src/pages/dataset/components/metedata/manage-modal-column.tsx (2)

16-16: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider extracting a shared type for addUpdateValue.

The addUpdateValue callback shape is duplicated here and in IManageValuesProps (interface.ts). Keeping them independently in sync is exactly how the previous optional/required originalValue mismatch 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 win

Unconditional setShouldSave(true) still triggers a save even when nothing changed.

The new equality check correctly skips addUpdateValue for no-op edits, but setShouldSave(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

📥 Commits

Reviewing files that changed from the base of the PR and between aaade35 and 5e10bfd.

📒 Files selected for processing (4)
  • web/src/pages/dataset/components/metedata/hooks/use-manage-values-modal.ts
  • web/src/pages/dataset/components/metedata/interface.ts
  • web/src/pages/dataset/components/metedata/manage-modal-column.tsx
  • web/src/pages/dataset/components/metedata/manage-modal.tsx

@wangq8
wangq8 merged commit c9f064d into infiniflow:main Jul 6, 2026
12 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants