CulverLab / CulverLab/sparcd-exploration

Tagger: a tab left open never sees species list changes, and a restored session gets no change popup

Open
#240 0 comments 0 reactions 1 assignee Claimed by @Chris-Schnaufer View on GitHub
Dominant language
TypeScript
Stars
6
Forks
3
Avg merge
2d 13h
Merged PRs (30d)
106

Description

The tagger loads the species list once when the page opens and keeps it for the whole session. The "Species vocabulary has changed" popup only runs on an explicit login. So someone who keeps a tab open for days never sees new or removed species, and someone whose session is restored on reload gets the new list but no popup telling them what changed.

Why:

- `apps/sparcd-tagger/src/lib/queries.ts:178` `useSpecies` has `staleTime: Infinity` and is keyed by `connectionId`, so nothing refetches until the connection counter changes.
- `apps/sparcd-tagger/src/components/SpeciesKeyBindingGate.tsx:70` only stages the diff when `shouldReconcileSpeciesProfile(connectionId)` is true, and a restored session starts at `connectionId` 0.

Where it shows: the species palette in Tag, and the popup that lists added, removed and renamed species.

Ideas, not decided:

1. Give the species query a finite `staleTime`, on the order of 15 minutes, and let it refetch on window focus. React Query does both with two options.
2. Run the diff whenever the species data changes, not only on login. `stageSpecies` already skips when nothing changed, so this is safe to call more often.
3. Restored sessions count as a login for the diff, so the popup shows on reload when the list moved.

The popup blocks Tag until acknowledged, so if the refetch lands mid-tagging the timing may want a look. Staging the change and showing it at the next image is one option.

Came out of Chris's question on #232 about how a user's list stays in sync with the server list.

Serves user story: [H2 Identify species in new uploads](https://github.com/CulverLab/sparcd-requirements/wiki/User-Stories#story-h2--identify-species-in-new-uploads)

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.