aws / aws/graph-explorer

SchemaDiscoveryBoundary shows sync screen when schema already exists in localforage

Open
#1,602 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
481
Forks
108
Avg merge
6d 8h
Merged PRs (30d)
5

Description

## Description

On startup, the `SchemaDiscoveryBoundary` displays the "Synchronizing..." loading screen even when a schema is already saved in localforage. This blocks the graph view (and other views using the boundary) unnecessarily.

### Analysis

The boundary in `SchemaDiscoveryBoundary.tsx` checks `isFetching` before checking whether the required data already exists. The `isFetching` flag is a union of both the schema discovery query and the edge connections query:

```ts
const isFetching = schemaDiscoveryQuery.isFetching || edgeDiscoveryQuery.isFetching;
```

Both queries in `useSchemaSync` use `staleTime: Infinity` with `initialData` from the Jotai store (hydrated from localforage). When `initialData` is present, TanStack Query v5 sets `dataUpdatedAt = Date.now()`, so the data is fresh and no fetch should occur.

However, if either query lacks `initialData` (e.g., `edgeConnections` is `undefined` in the saved schema), that query will fetch. Since the boundary checks `isFetching` before `hasRequiredData`, it shows the sync screen even though the schema data needed by the current view is already available.

### Key files

- `packages/graph-explorer/src/components/SchemaDiscoveryBoundary.tsx` — the boundary component with the check ordering
- `packages/graph-explorer/src/hooks/useSchemaSync.ts` — the hook that subscribes to both queries
- `packages/graph-explorer/src/connector/queries/schemaSyncQuery.ts` — schema discovery query options
- `packages/graph-explorer/src/connector/queries/edgeConnectionsQuery.ts` — edge connections query options

## Steps to Reproduce

1. Connect to a graph database and sync the schema
2. Reload the page (schema is now saved in localforage)
3. Navigate to the graph view

## Expected Behavior

The graph view should render immediately using the saved schema, without showing the "Synchronizing..." screen.

---

> [!IMPORTANT]
> If you are interested in working on this issue, please leave a comment.

> [!TIP]
> Please use a 👍 reaction to provide a +1/vote. This helps the community and maintainers prioritize this request.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.