You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: refresh the v2 gallery when a ROM is edited or matched
The v2 gallery renders from `galleryRoms.byPosition`, but every v2 write
site only patched v1's `stores/roms`, whose `_allRoms` the gallery never
reads. Edits and matches replace the ROM with a fresh object from the API
response, so the card kept showing the pre-edit name and cover until its
window happened to be refetched. Optimistic toggles appeared to work only
because they mutate the cached object in place, and the gallery holds that
same reference.
Add `useRomSync` and route the v2 write sites through it:
- `syncRom` fans a write out to both stores. `galleryRoms.update` already
existed for exactly this and had no callers.
- `applyRomWrite` (edit / match dialogs) also refetches when an in-place
swap would leave the list lying: any active filter, since a match
rewrites provider ids, name and the metadata behind half the drawer, or
a change to the value the gallery is currently ordered by.
- `refreshAfterUserStateChange` covers favourite / status writes, guarded
narrowly on the filters those can actually move. The existing "drop it
from the Favourites view" branches check v1's collection context, which
v2 never sets, so they were dead under v2.
Optimistic toggles keep the cheap in-place update: invalidating the
windows costs skeletons and the scroll position.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
0 commit comments