From fdf63b7ac3be947fb2b9c43ce1cc18c90ad24c66 Mon Sep 17 00:00:00 2001 From: Guillermo Puente Date: Wed, 4 Sep 2024 15:47:47 -0400 Subject: [PATCH] feat: handle syncUnitStatus not found error --- src/hooks/useDocumentDriveServer.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hooks/useDocumentDriveServer.ts b/src/hooks/useDocumentDriveServer.ts index 4530e49a..79fd2c3d 100644 --- a/src/hooks/useDocumentDriveServer.ts +++ b/src/hooks/useDocumentDriveServer.ts @@ -5,6 +5,7 @@ import { SharingType, UiNode, } from '@powerhousedao/design-system'; +import { SynchronizationUnitNotFoundError } from 'document-drive'; import { DriveInput, IDocumentDriveServer, @@ -579,7 +580,10 @@ export function useDocumentDriveServer( ): Promise => { if (sharingType === LOCAL) return; try { - return server.getSyncStatus(syncId); + const syncStatus = server.getSyncStatus(syncId); + if (syncStatus instanceof SynchronizationUnitNotFoundError) + return 'INITIAL_SYNC'; + return syncStatus; } catch (error) { console.error(error); return ERROR;