From 6bff97ace2373b89513d0e729a59bab507d4d067 Mon Sep 17 00:00:00 2001 From: Silvano Cerza Date: Sat, 11 Jan 2025 17:08:11 +0100 Subject: [PATCH] Simplify upload dialog to not upload directly --- .../upload-all-files-dialog/component.tsx | 23 ++++--------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/src/views/upload-all-files-dialog/component.tsx b/src/views/upload-all-files-dialog/component.tsx index 2bd3f6e..24d6136 100644 --- a/src/views/upload-all-files-dialog/component.tsx +++ b/src/views/upload-all-files-dialog/component.tsx @@ -121,25 +121,10 @@ const UploadDialogContent = ({ onCancel }: { onCancel: () => void }) => { if (abortController.signal.aborted) { return; } - await plugin.client.uploadFile( - plugin.settings.githubOwner, - plugin.settings.githubRepo, - plugin.settings.githubBranch, - file.path, - ); - // Reset dirty state - plugin.metadataStore.data[file.path].dirty = false; - - // Gets the new SHA of the file - const sha = await plugin.client.getFileSha( - plugin.settings.githubOwner, - plugin.settings.githubRepo, - plugin.settings.githubBranch, - file.path, - ); - plugin.metadataStore.data[file.path].sha = sha; - await plugin.metadataStore.save(); - + await plugin.eventsConsumer.process({ + type: "modify", + filePath: file.path, + }); if (abortController.signal.aborted) { // Check abort state only after the uploaded file metadata // is updated, otherwise we risk having outdated SHAs