Repository navigation
Fixes #39123: Knowledge Graph toolbar refreshes filter options after a level change - #39158
Open
detail-app[bot] wants to merge 2 commits into
Open
detail-app[bot] wants to merge 2 commits into
detail-app[bot] wants to merge 2 commits into
Conversation
detail-app
Bot
force-pushed
the
detail/bug-fix/fixes-39123-knowledge-graph-toolbar-refreshes-filt-a327e3
branch
from
November 28, 2026 06:11
2f73152 to
3652ddf
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Detail bug report: View on Detail
Describe your changes:
Fixes #39123
I worked on refreshing the Knowledge Graph toolbar's Entity Type and Relationship Type filter pickers after a graph level change, because the shared core
TreeSelectcaches its fetched tree for the lifetime of the instance —useTreeSelectDataonly re-callsfetchDataon mount and on search-term changes, never whenfetchDatawould return different nodes. The pickers worked around the initial empty → non-empty case with a remountkey={roots.length === 0 ? 'empty' : 'ready'}, but that key only flips on the empty boundary.filterOptionsis depth-scoped (the server aggregates option lists and counts from the traversal at the requested depth), anduseRetainedValuekeeps the previous graph result during a level-change refetch, so a level change replacesfilterOptionsin place — non-empty → non-empty. The key never flipped, so theTreeSelectkept serving the previous level's cached tree with stale counts and missing/extra types.Type of change:
High-level design:
Small change — no high-level design needed. The fix keys the
TreeSelectremount on an option-content signature (id:countjoined) instead of emptiness, in bothEntityTypePickerandRelationshipTypePicker. The signature changes whenever the depth-scoped option list or counts change, forcing a remount so the new instance re-fetches the fresh tree. The fix is consumer-only —use-tree-select-data.tsand the sharedTreeSelectare untouched, so every other consumer (glossary term picker, domain scope picker, etc.) is unaffected. Alternatives considered: re-fetching inuseTreeSelectDatawhenfetchDataidentity changes — rejected because it would change behavior for every consumer, including those that fetch paginated/async roots.Tests:
Use cases covered
filterOptionsis a new object with identical id+count content (no spurious remounts on unrelated re-renders).disabledtrue → false.Unit tests
openmetadata-ui/src/main/resources/ui/src/components/discovery/knowledge-graph/KnowledgeGraphToolbar.test.tsx(new). The suite stubs the sharedTreeSelectwith a mount-counting stand-in (jsdom cannot render the react-aria popover) and asserts the remount contract for both pickers.Backend integration tests
filterOptionsis already computed server-side per depth.Ingestion integration tests
Playwright (UI) tests
Manual testing performed
yarn tsc:check(app) reports 34 errors, identical to the pre-existing baseline — zero new type errors (all pre-existing errors are in unrelatedSSOUtils.test.ts/ChartDetailsUtils.test.tsx).yarn type-check(core-components) passes.yarn buildsucceeds for both the app and core-components packages.2.0.0-SNAPSHOTserver/db/ingestion Docker images are not on the registry, the Elasticsearch image fails to materialize under this sandbox's overlay2 storage, and available RAM (~2.4 GB) is insufficient for Elasticsearch + MySQL + the server JVM. The behavioral contract that E2E would verify (fresh options/counts after a level change) is covered by the unit suite, which asserts the remount contract that is the root cause of the staleness.UI screen recording:
Not applicable — this is a bug fix to existing filter picker behavior (correctness of the option list after a level change), not a new UI feature or feature task with UI impact. The fix has no visible UI beyond the dropdown already showing the correct options.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.REVIEW.md(thepr-checklistskill runs it) and fixed every 🔴 finding, or answered it on the line below.docs/decisions/(see itsREADME.md). This description is gone fromgit logafter the squash-merge.Automatic Fixes PRs can be configured here.