From 3cd6d5a65d66d5d0edcff7d8f910ed37c8cbd86a Mon Sep 17 00:00:00 2001 From: sunghyunkang1111 <114709653+sunghyunkang1111@users.noreply.github.com> Date: Thu, 16 Oct 2025 16:45:50 -0500 Subject: [PATCH 1/2] Added ignore partition key option (#2227) * Added ignore partition key option * fix unit test * fix unit test * Fix Unit Test --- src/Common/dataAccess/updateDocument.ts | 10 ++- .../Panes/SettingsPane/SettingsPane.tsx | 37 +++++++++++ .../__snapshots__/SettingsPane.test.tsx.snap | 62 +++++++++++++++++++ src/Shared/StorageUtility.ts | 1 + 4 files changed, 109 insertions(+), 1 deletion(-) diff --git a/src/Common/dataAccess/updateDocument.ts b/src/Common/dataAccess/updateDocument.ts index dd97b46de..7985ffa43 100644 --- a/src/Common/dataAccess/updateDocument.ts +++ b/src/Common/dataAccess/updateDocument.ts @@ -1,5 +1,6 @@ import { Item, RequestOptions } from "@azure/cosmos"; import { HttpHeaders } from "Common/Constants"; +import { LocalStorageUtility, StorageKey } from "Shared/StorageUtility"; import { CollectionBase } from "../../Contracts/ViewModels"; import DocumentId from "../../Explorer/Tree/DocumentId"; import { logConsoleInfo, logConsoleProgress } from "../../Utils/NotificationConsoleUtils"; @@ -23,10 +24,17 @@ export const updateDocument = async ( [HttpHeaders.partitionKey]: documentId.partitionKeyValue, } : {}; + + // If user has chosen to ignore partition key on update, pass null instead of actual partition key value + const ignorePartitionKeyOnDocumentUpdateFlag = LocalStorageUtility.getEntryBoolean( + StorageKey.IgnorePartitionKeyOnDocumentUpdate, + ); + const partitionKey = ignorePartitionKeyOnDocumentUpdateFlag ? undefined : getPartitionKeyValue(documentId); + const response = await client() .database(collection.databaseId) .container(collection.id()) - .item(documentId.id(), getPartitionKeyValue(documentId)) + .item(documentId.id(), partitionKey) .replace(newDocument, options); logConsoleInfo(`Successfully updated ${entityName} ${documentId.id()}`); diff --git a/src/Explorer/Panes/SettingsPane/SettingsPane.tsx b/src/Explorer/Panes/SettingsPane/SettingsPane.tsx index c8106eca7..046e827fd 100644 --- a/src/Explorer/Panes/SettingsPane/SettingsPane.tsx +++ b/src/Explorer/Panes/SettingsPane/SettingsPane.tsx @@ -204,6 +204,9 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({ ? (LocalStorageUtility.getEntryString(StorageKey.MongoGuidRepresentation) as Constants.MongoGuidRepresentation) : Constants.MongoGuidRepresentation.CSharpLegacy, ); + const [ignorePartitionKeyOnDocumentUpdate, setIgnorePartitionKeyOnDocumentUpdate] = useState( + LocalStorageUtility.getEntryBoolean(StorageKey.IgnorePartitionKeyOnDocumentUpdate), + ); const styles = useStyles(); @@ -424,6 +427,12 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({ LocalStorageUtility.setEntryString(StorageKey.MongoGuidRepresentation, mongoGuidRepresentation); } + // Advanced settings + LocalStorageUtility.setEntryBoolean( + StorageKey.IgnorePartitionKeyOnDocumentUpdate, + ignorePartitionKeyOnDocumentUpdate, + ); + setIsExecuting(false); logConsoleInfo( `Updated items per page setting to ${LocalStorageUtility.getEntryNumber(StorageKey.ActualItemPerPage)}`, @@ -453,6 +462,10 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({ ); } + logConsoleInfo( + `${ignorePartitionKeyOnDocumentUpdate ? "Enabled" : "Disabled"} ignoring partition key on document update`, + ); + refreshExplorer && (await explorer.refreshExplorer()); closeSidePanel(); }; @@ -593,6 +606,13 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({ setMongoGuidRepresentation(option.key as Constants.MongoGuidRepresentation); }; + const handleOnIgnorePartitionKeyOnDocumentUpdateChange = ( + ev: React.MouseEvent, + checked?: boolean, + ): void => { + setIgnorePartitionKeyOnDocumentUpdate(!!checked); + }; + const choiceButtonStyles = { root: { clear: "both", @@ -1137,6 +1157,23 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({ )} + + +
Advanced Settings
+
+ +
+ +
+
+
)} diff --git a/src/Explorer/Panes/SettingsPane/__snapshots__/SettingsPane.test.tsx.snap b/src/Explorer/Panes/SettingsPane/__snapshots__/SettingsPane.test.tsx.snap index 41759f1c7..e46ba57ea 100644 --- a/src/Explorer/Panes/SettingsPane/__snapshots__/SettingsPane.test.tsx.snap +++ b/src/Explorer/Panes/SettingsPane/__snapshots__/SettingsPane.test.tsx.snap @@ -575,6 +575,37 @@ exports[`Settings Pane should render Default properly 1`] = ` + + +
+ Advanced Settings +
+
+ +
+ +
+
+
+ + +
+ Advanced Settings +
+
+ +
+ +
+
+
{ From 299612023564af0de01973c6c472fc0cd667c22f Mon Sep 17 00:00:00 2001 From: Dmitry Shilov Date: Mon, 20 Oct 2025 21:49:41 +0200 Subject: [PATCH 2/2] fix: Clean file input after uploading files (#2189) * fix: Clean file input after uploading files - Enhance file upload component to trigger re-renders on state changes * fix: Clean file input after uploading files - Enhance file upload component to trigger re-renders on state changes --- src/Explorer/Panes/UploadItemsPane/UploadItemsPane.tsx | 6 +++++- .../__snapshots__/UploadItemsPane.test.tsx.snap | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Explorer/Panes/UploadItemsPane/UploadItemsPane.tsx b/src/Explorer/Panes/UploadItemsPane/UploadItemsPane.tsx index 344dc13c7..b2f8fe590 100644 --- a/src/Explorer/Panes/UploadItemsPane/UploadItemsPane.tsx +++ b/src/Explorer/Panes/UploadItemsPane/UploadItemsPane.tsx @@ -13,7 +13,7 @@ import { import { Upload } from "Common/Upload/Upload"; import { UploadDetailsRecord } from "Contracts/ViewModels"; import { logConsoleError } from "Utils/NotificationConsoleUtils"; -import React, { ChangeEvent, FunctionComponent, useState } from "react"; +import React, { ChangeEvent, FunctionComponent, useReducer, useState } from "react"; import { getErrorMessage } from "../../Tables/Utilities"; import { useSelectedNode } from "../../useSelectedNode"; import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneForm"; @@ -57,6 +57,7 @@ export const UploadItemsPane: FunctionComponent = ({ onUpl const [uploadFileData, setUploadFileData] = useState([]); const [formError, setFormError] = useState(""); const [isExecuting, setIsExecuting] = useState(); + const [reducer, setReducer] = useReducer((x) => x + 1, 1); const onSubmit = () => { setFormError(""); @@ -75,6 +76,7 @@ export const UploadItemsPane: FunctionComponent = ({ onUpl (uploadDetails) => { setUploadFileData(uploadDetails.data); setFiles(undefined); + setReducer(); // Trigger a re-render to update the UI with new upload details // Emit the upload details to the parent component onUpload && onUpload(uploadDetails.data); }, @@ -95,6 +97,7 @@ export const UploadItemsPane: FunctionComponent = ({ onUpl const props: RightPaneFormProps = { formError, isExecuting: isExecuting, + isSubmitButtonDisabled: !files || files.length === 0, submitButtonText: "Upload", onSubmit, }; @@ -192,6 +195,7 @@ export const UploadItemsPane: FunctionComponent = ({ onUpl
@@ -11,6 +12,7 @@ exports[`Upload Items Pane should render Default properly 1`] = ` >