fix: resolve auth race conditions, planned task sync, and destructive UI#186
Merged
Conversation
- Consolidate auth-state handling into single async useEffect; replace
previousAuthState state with prevAuthRef to avoid extra re-renders
- Run migrateToLocalStorage before setDataService on logout so loadData
reads the fresh localStorage snapshot instead of racing the write
- Reset todoLoadedRef/plannedLoadedRef before setLoading(true) to block
mutations against the incoming service until load completes
- After login migration, reload planned tasks from Supabase so the
session reflects what migration wrote
- migrateFromLocalStorage skips planned tasks if Supabase already has
any, preventing stale localStorage data from overwriting remote tasks
- ProjectSheet now awaits forceSyncToDatabase before closing
- ContextMenuItem gains variant prop ("default" | "destructive")
- Destructive button hover changed to hover:opacity-90 to avoid Tailwind
v4 oklch color-mix issues
- Delete dialog button order corrected: Cancel before Delete
- Add --destructive-foreground CSS token to both light and dark themes
- Sync CHANGELOG with all of the above
Deploying timetrackerpro with
|
| Latest commit: |
7288621
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://6c854253.timetrackerpro.pages.dev |
| Branch Preview URL: | https://fix-two-issues.timetrackerpro.pages.dev |
This was
linked to
issues
Jun 18, 2026
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.
Summary
Fixes two categories of issues: auth/sync race conditions that caused planned tasks to be lost or overwritten on login/logout, and several destructive UI styling inconsistencies introduced by the Tailwind v4 migration.
Type of Change
Related Issue
Closes #
Changes Made
Auth / sync race conditions (
src/contexts/TimeTrackingContext.tsx,src/services/supabaseService.ts):useEffectwith an asynchandleAuthChange; replacedpreviousAuthStatestate withprevAuthRef(ref) to avoid extra re-rendersmigrateToLocalStoragenow runs beforesetDataServicesoloadDatareads the freshly-written localStorage snapshot instead of racing the migration writetodoLoadedRef/plannedLoadedRefreset beforesetLoading(true)to block mutations against the incoming service until load completesmigrateFromLocalStorageskips writing planned tasks if Supabase already has any — prevents stale localStorage data (from a previous logout) from overwriting tasks created on another deviceProjectSheet sync (
src/components/ProjectSheet.tsx):handleSubmitnowawaitsforceSyncToDatabase()before closing the sheet — previously the sheet dismissed before sync completedDestructive UI (
src/components/ui/context-menu.tsx,DeleteConfirmationDialog.tsx,ProjectManagement.tsx,PlannedTaskCard.tsx,src/index.css):ContextMenuItemgains avariantprop ("default" | "destructive") — destructive variant applies correct colors at rest and on focus, replacing ad-hocclassNameoverrideshover:bg-destructive/90tohover:opacity-90to avoid Tailwind v4 oklch color-mix issues--destructive-foregroundCSS token added for both light and dark themesChecklist
Documentation
CHANGELOG.mdupdated accordinglyGeneral
mainpnpm test,pnpm lint, andpnpm buildNotes for Reviewers
The auth race condition fix changes the shape of the auth
useEffectsignificantly — two separate effects collapsed into one. The net behavior is identical for the happy path; the fix closes the window whereloadDatacould fire against the new service beforemigrateToLocalStoragefinished writing.