Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(auto-sync): Add an AutoSyncProvider and trigger a sync changes when needed #1284

Merged
merged 1 commit into from
Feb 8, 2024

Conversation

xrutayisire
Copy link
Collaborator

@xrutayisire xrutayisire commented Feb 2, 2024

Context

The Solution

  • Rename useActionQueue
  • Improve the way the unSyncChanges are created (not perfect but the goal was to improve it still)
  • Create a global top level AutoSyncProvider
  • Trigger the sync manually when needed
  • Trigger the sync automatically on page first mount
  • Trigger the sync automatically when user goes back online
  • Fix the ErrorBoundary fallback still having potentiel error on it, an ErrorBoundary fallback should be super simple and ensure no errors can happen on it
  • Move the Changes item link
  • Create a Changes button that redirect (temporary solution as it will be a Modal in the future)
  • Create an AutoSyncStatusIndicator to display the sync status
  • Block the Changes page URL when sync is syncing, failed or synced
  • Remove unnecessary getLegacySliceMachineState because it's the same code as "getState", easier for the future removal of getState

Impact / Dependencies

  • None

Copy link

linear bot commented Feb 2, 2024

Copy link

vercel bot commented Feb 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
slice-machine ✅ Ready (Inspect) Visit Preview Feb 8, 2024 3:36pm

@xrutayisire xrutayisire changed the title feat(auto-sync): Add an AutoSyncProvider and trigger a sync changes w… feat(auto-sync): Add an AutoSyncProvider and trigger a sync changes when needed Feb 2, 2024
@xrutayisire xrutayisire force-pushed the xru/auto-sync-provider branch from eaa78ac to 627ef87 Compare February 4, 2024 22:08
@xrutayisire xrutayisire force-pushed the xru/auto-sync-provider branch from 627ef87 to 70d9a10 Compare February 5, 2024 16:45
Copy link
Contributor

@hypervillain hypervillain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useActionQueue and AutoSync look very good

collisionPadding={280}
trigger={
<Box padding={{ bottom: 24 }}>
{autoSyncStatus === "failed" ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible alternate syntax: ["failed", "sync", "syncing"].includes(autoSyncStatus)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is Typescript then, I did the same comment to one PR from Baptiste and TypeScript don't understand this syntax :/

Screenshot 2024-02-07 at 18 57 35

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood

loggedIn = isOnline && authStatus === AuthStatus.AUTHORIZED,
} = args;

console.log("1. Just calling syncChanges");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed !

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed, console.log for QA on the alpha

@xrutayisire xrutayisire force-pushed the xru/auto-sync-provider branch from 70d9a10 to 156c971 Compare February 7, 2024 18:02
@xrutayisire xrutayisire force-pushed the xru/remove-rename-slice-saga branch from cc80883 to 343c771 Compare February 7, 2024 18:05
Base automatically changed from xru/remove-rename-slice-saga to main February 7, 2024 18:06
@xrutayisire xrutayisire force-pushed the xru/auto-sync-provider branch 2 times, most recently from 0877fcb to 42e3c71 Compare February 7, 2024 18:37
@xrutayisire xrutayisire force-pushed the xru/auto-sync-provider branch from 16300ac to 04100b9 Compare February 8, 2024 15:30
@xrutayisire xrutayisire merged commit 9930d12 into main Feb 8, 2024
34 checks passed
@xrutayisire xrutayisire deleted the xru/auto-sync-provider branch February 8, 2024 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants