Skip to content

Commit fa59f26

Browse files
committed
Fix type errors.
1 parent c5c7a3f commit fa59f26

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

tools/diagnostics-app/src/app/views/layout.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default function ViewsLayout({ children }: { children: React.ReactNode })
4343
const powerSync = usePowerSync();
4444
const navigate = useNavigate();
4545

46-
const [syncStatus, setSyncStatus] = React.useState(sync.syncStatus);
46+
const [syncStatus, setSyncStatus] = React.useState(sync?.syncStatus);
4747
const [syncError, setSyncError] = React.useState<Error | null>(null);
4848
const { title } = useNavigationPanel();
4949

@@ -101,13 +101,13 @@ export default function ViewsLayout({ children }: { children: React.ReactNode })
101101

102102
// Cannot use `useStatus()`, since we're not using the default sync implementation.
103103
React.useEffect(() => {
104-
const l = sync.registerListener({
104+
const l = sync?.registerListener({
105105
statusChanged: (status) => {
106106
setSyncStatus(status);
107107
setSyncError(status.dataFlowStatus.downloadError ?? null);
108108
}
109109
});
110-
return () => l();
110+
return () => l?.();
111111
}, []);
112112

113113
const drawerWidth = 320;

tools/diagnostics-app/src/app/views/sync-diagnostics.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export default function SyncDiagnosticsPage() {
8282
// Similar to db.currentState.hasSynced, but synchronized to the onChange events
8383
const { synced_at } = await db.get<{ synced_at: string | null }>('SELECT powersync_last_synced_at() as synced_at');
8484
setlastSyncedAt(synced_at ? new Date(synced_at + 'Z') : null);
85-
if (synced_at != null && !sync.syncStatus.dataFlowStatus.downloading) {
85+
if (synced_at != null && !sync?.syncStatus.dataFlowStatus.downloading) {
8686
// These are potentially expensive queries - do not run during initial sync
8787
const bucketRows = await db.getAll(BUCKETS_QUERY);
8888
const tableRows = await db.getAll(TABLES_QUERY);

0 commit comments

Comments
 (0)