diff --git a/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.tsx b/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.tsx index 47219274b..f13622061 100644 --- a/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.tsx +++ b/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.tsx @@ -1246,9 +1246,18 @@ export const DocumentsTabComponent: React.FunctionComponent { - // TODO Add fields rather than replace - setColumnDefinitions(extractColumnDefinitionsFromDocument(document)); + const currentIds = new Set(columnDefinitions.map((columnDefinition) => columnDefinition.id)); + extractColumnDefinitionsFromDocument(document).forEach((columnDefinition) => { + if (!currentIds.has(columnDefinition.id)) { + columnDefinitions.push(columnDefinition); + } + }); + setColumnDefinitions([...columnDefinitions]); }; /** @@ -1359,6 +1368,7 @@ export const DocumentsTabComponent: React.FunctionComponent resizeObserver.disconnect(); // clean up }, []); + // Column definition is a map to garantee uniqueness const [columnDefinitions, setColumnDefinitions] = useState(() => extractColumnDefinitionsFromDocument({ id: "id",