RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Fix: Entering a letter in the parser tree selection field and then clicking the collapse icon triggers a data message. (#21683)
balibabu6fb76f20efdc
diff --git a/web/src/components/parser-tree-select/index.test.tsx b/web/src/components/parser-tree-select/index.test.tsxindex 2d7304b8db..dcdce220b2 100644--- a/web/src/components/parser-tree-select/index.test.tsx+++ b/web/src/components/parser-tree-select/index.test.tsx@@ -155,6 +155,30 @@ describe('ParserTreeSelect', () => {expect([...mockTreeProps.loadingIds]).toContain('pipeline:pipe-2');});+ it("keeps a collapsed branch's versions instead of reverting to the loading placeholder", () => {+ mockVersionQueries = [+ { isSuccess: true, data: VersionList },+ { isSuccess: true, data: [{ id: 'v2', title: 'v2 title' }] },+ ];+ render(+ <ParserTreeSelect value="pipeline:pipe-1:v1" onChange={jest.fn()} />,+ );+ act(() => {+ mockTreeProps.onExpandedChange(+ new Set(['pipeline:pipe-1', 'pipeline:pipe-2']),+ );+ });+ // Collapse pipe-2: its versions must stay in the tree. Reverting to the+ // empty-titled loading placeholder would make the search filter drop the+ // whole branch while a search term is active.+ act(() => {+ mockTreeProps.onExpandedChange(new Set(['pipeline:pipe-1']));+ });++ const collapsed = mockTreeProps.data[1];+ expect(collapsed.children[0].id).toBe('pipeline:pipe-2:v2');+ });+it('shows a disabled empty row for a branch with no published versions', () => {mockVersionQueries = [{ isSuccess: true, data: VersionList },diff --git a/web/src/components/parser-tree-select/use-parser-tree-data.tsx b/web/src/components/parser-tree-select/use-parser-tree-data.tsxindex 74396475dc..c66e246c3f 100644--- a/web/src/components/parser-tree-select/use-parser-tree-data.tsx+++ b/web/src/components/parser-tree-select/use-parser-tree-data.tsx@@ -70,19 +70,44 @@ export function useParserTreeData({ value }: { value?: string }) {}}- // Versions load for the selected pipeline plus every expanded branch. The- // set is derived, so collapsing a branch drops its observer and a re-expand- // refetches (gcTime: 0) — always-fresh data over a cached shortcut.+ // The fetch set only grows: once a branch has been expanded, its versions+ // stay loaded for the rest of the select's lifetime. Dropping the query+ // observer on collapse would revert the branch's children to the+ // empty-titled loading placeholder, and an active search filter would then+ // drop the whole branch from the results. Freshness still comes from+ // gcTime: 0 across remounts and from version mutations invalidating the+ // shared query key. Render-phase adjustment, same pattern as the+ // selected-branch expansion above.+ const [loadedCanvasIds, setLoadedCanvasIds] = useState<Set<string>>(+ new Set(),+ );+ const [prevExpandedIds, setPrevExpandedIds] = useState(expandedIds);+ if (expandedIds !== prevExpandedIds) {+ setPrevExpandedIds(expandedIds);+ setLoadedCanvasIds((prev) => {+ const next = new Set(prev);+ let added = false;+ expandedIds.forEach((nodeId) => {+ const parsed = parseParserOptionValue(nodeId);+ if (+ parsed?.kind === ParserOptionKind.Pipeline &&+ !next.has(parsed.rawId)+ ) {+ next.add(parsed.rawId);+ added = true;+ }+ });+ return added ? next : prev;+ });+ }++ // Versions load for the selected pipeline plus every branch expanded so+ // far. Sorted so the useQueries array stays stable across changes.const versionCanvasIds = useMemo(() => {- const ids = new Set<string>();+ const ids = new Set(loadedCanvasIds);if (selectedPipelineId) ids.add(selectedPipelineId);- expandedIds.forEach((nodeId) => {- const parsed = parseParserOptionValue(nodeId);- if (parsed?.kind === ParserOptionKind.Pipeline) ids.add(parsed.rawId);- });- // Sorted so the useQueries array stays stable across expansion changes.return [...ids].sort();- }, [selectedPipelineId, expandedIds]);+ }, [selectedPipelineId, loadedCanvasIds]);const versionResults = useFetchCanvasVersions(versionCanvasIds);const { versionsByCanvas, loadingCanvasIds } = useMemo(() => {