diff --git a/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.test.tsx b/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.test.tsx index 267db89b6..bdf0549a5 100644 --- a/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.test.tsx +++ b/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.test.tsx @@ -19,7 +19,7 @@ import { getSaveExistingDocumentButtonState, getSaveNewDocumentButtonState, getTabsButtons, - showPartitionKey, + showPartitionKey } from "Explorer/Tabs/DocumentsTabV2/DocumentsTabV2"; import { ReactWrapper, ShallowWrapper, mount, shallow } from "enzyme"; import * as ko from "knockout"; @@ -68,7 +68,7 @@ jest.mock("Explorer/Controls/Dialog", () => ({ useDialog: { getState: jest.fn(() => ({ showOkCancelModalDialog: (title: string, subText: string, okLabel: string, onOk: () => void) => onOk(), - showOkModalDialog: () => {}, + showOkModalDialog: () => { }, })), }, })); @@ -474,3 +474,9 @@ describe("Documents tab (noSql API)", () => { }); }); }); + +describe("Documents tab", () => { + it("should add strings to array without duplicate", () => { + addStringsNoDuplicates(test this); + }); +}); \ No newline at end of file diff --git a/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.tsx b/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.tsx index 0a5e2433d..c9220f601 100644 --- a/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.tsx +++ b/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.tsx @@ -459,6 +459,8 @@ export interface IDocumentsTabComponentProps { isTabActive: boolean; } +const getUniqueId = (collection: ViewModels.CollectionBase): string => `${collection.databaseId}-${collection.id()}`; + const defaultSqlFilters = ['WHERE c.id = "foo"', "ORDER BY c._ts DESC", 'WHERE c.id = "foo" ORDER BY c._ts DESC']; const defaultMongoFilters = ['{"id":"foo"}', "{ qty: { $gte: 20 } }"]; @@ -1756,7 +1758,7 @@ export const DocumentsTabComponent: React.FunctionComponent setIsFilterFocused(false)} /> - + {addStringsNoDuplicate( lastFilterContents, isPreferredApiMongoDB ? defaultMongoFilters : defaultSqlFilters,