fix: migrate clients between localStorage and Supabase on auth change#155
Merged
Conversation
migrateFromLocalStorage and migrateToLocalStorage handled every entity except clients, so a guest who added clients lost them on sign-in (never pushed to Supabase) and an authenticated user's clients were never written back to localStorage on sign-out. - migrateFromLocalStorage now reads guest clients, includes them in the early-return guard, and non-destructively upserts any whose name is not already on the account (clients synced from another device are kept). - migrateToLocalStorage now writes the account's clients to localStorage. https://claude.ai/code/session_01Vj59LNCu4LCzWvm4myW4wC
7ac5b93 to
2097177
Compare
Deploying timetrackerpro with
|
| Latest commit: |
6d38c05
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d249a939.timetrackerpro.pages.dev |
| Branch Preview URL: | https://claude-clients-storage-save.timetrackerpro.pages.dev |
The waitFor condition (projects.length > 0) resolved immediately against the initial default projects, before the async localStorage load ran. Move the renamed-name assertion inside waitFor so it polls until the loaded state is actually present. https://claude.ai/code/session_01C2Az2Kf6VUGng8d3MtoXdN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
migrateFromLocalStorage and migrateToLocalStorage handled every entity
except clients, so a guest who added clients lost them on sign-in (never
pushed to Supabase) and an authenticated user's clients were never
written back to localStorage on sign-out.
early-return guard, and non-destructively upserts any whose name is not
already on the account (clients synced from another device are kept).
https://claude.ai/code/session_01Vj59LNCu4LCzWvm4myW4wC