Skip to content

Commit

Permalink
feat: handle syncUnitStatus not found error
Browse files Browse the repository at this point in the history
  • Loading branch information
gpuente committed Sep 4, 2024
1 parent b3c6c9d commit fdf63b7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/hooks/useDocumentDriveServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
SharingType,
UiNode,
} from '@powerhousedao/design-system';
import { SynchronizationUnitNotFoundError } from 'document-drive';
import {
DriveInput,
IDocumentDriveServer,
Expand Down Expand Up @@ -579,7 +580,10 @@ export function useDocumentDriveServer(
): Promise<SyncStatus | undefined> => {
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;
Expand Down

0 comments on commit fdf63b7

Please sign in to comment.