Skip to content

fix(workflow): use correct field ID in KB metadata filter selection#34149

Merged
hjlarry merged 6 commits into
langgenius:mainfrom
shawny011717:fix/kb-metadata-field-selection
May 7, 2026
Merged

fix(workflow): use correct field ID in KB metadata filter selection#34149
hjlarry merged 6 commits into
langgenius:mainfrom
shawny011717:fix/kb-metadata-field-selection

Conversation

@shawny011717
Copy link
Copy Markdown
Contributor

@shawny011717 shawny011717 commented Mar 26, 2026

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

Fixes #33577.
fix #35844

The onClick handler in the metadata field dropdown (AddCondition component) was attached to the inner text <div> instead of the outer row <div>. This meant clicks landing on the icon, type label, or row padding did not register the intended field — the resulting mis-hit caused the UI to appear to always select the first field. Moving the handler to the row element ensures the full clickable area maps to the correct metadata item.

Screenshots

N/A (logic-only fix, no visual change)

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. Contribution guidelines
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran cd web && npx lint-staged to appease the lint gods

Move onClick handler from inner text div to the outer row div in the
metadata field dropdown. The handler was previously attached only to the
name label, causing clicks on other parts of the row (icon, type label,
padding) to not register the correct selection.

Fixes langgenius#33577.
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Mar 26, 2026
@github-actions github-actions Bot added the web This relates to changes on the web. label Mar 26, 2026
@shawny011717
Copy link
Copy Markdown
Contributor Author

Gentle ping — this one's been waiting ~3 weeks for review. Happy to rebase or break it into smaller diffs if that helps. 🙏

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels May 7, 2026
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels May 7, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label May 7, 2026
@hjlarry
Copy link
Copy Markdown
Contributor

hjlarry commented May 7, 2026

the origin fix only handles clicks on the full row, not only the field name text

the reason is Built-in fields all share the same metadata_id value (built-in), so matching by metadata_id alone could incorrectly display every built-in condition as document_name.

also fix a layering issue where the dropdown could be hidden behind the metadata panel.
img_v3_0211f_573e998a-8832-4950-b1c1-65ae5c01083g

@hjlarry hjlarry added this pull request to the merge queue May 7, 2026
Merged via the queue into langgenius:main with commit 376c43e May 7, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Metadata Filter Conditions always returns document_name regardless of the operator selected KB metadata filtering always select first field

2 participants