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(sync): support offline commit- [INS-4226] #7811

Merged
merged 2 commits into from
Aug 9, 2024

Conversation

CurryYangxx
Copy link
Member

@CurryYangxx CurryYangxx commented Aug 6, 2024

Support offline commit for Insomnia cloud sync.

  • Add fallback data when getting remote sync data

@CurryYangxx CurryYangxx marked this pull request as draft August 6, 2024 02:26
@CurryYangxx CurryYangxx changed the title feat(sync): support offline commit feat(sync): support offline commit- [INS-4226] Aug 6, 2024
@CurryYangxx CurryYangxx marked this pull request as ready for review August 6, 2024 03:11
@CurryYangxx CurryYangxx requested a review from a team August 6, 2024 03:12
remoteBranches = (
remoteBranchesCache[workspaceId] || (await vcs.getRemoteBranchNames())
).sort();
compare =
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to split these in two try/catch?
My thought is: In case one of them fails and the other works we would at least have the correct value for one of them

Copy link
Contributor

Choose a reason for hiding this comment

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

Also looking at this part and i have another question, will splitting introduce inconsistency? this seems for avoiding noise when offline, it might be great if we could differentiate different errors.

Copy link
Member Author

Choose a reason for hiding this comment

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

Previously, we returned an error if any of them failed, and did not show the entrance for sync. Now, I have wrapped the logic that relies on the network in a new try/catch block so that we can get some of the sync data when the request fails or the user is offline. This allows users to use the sync features that do not depend on the network.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you have some other suggestions for error handling?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure I have other thoughts on this. I feel much more confident baed on your comment so LGTM

Copy link
Contributor

@ihexxa ihexxa left a comment

Choose a reason for hiding this comment

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

Overall lgtm and error handling might worth a bit discussion.

remoteBranches = (
remoteBranchesCache[workspaceId] || (await vcs.getRemoteBranchNames())
).sort();
compare =
Copy link
Contributor

Choose a reason for hiding this comment

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

Also looking at this part and i have another question, will splitting introduce inconsistency? this seems for avoiding noise when offline, it might be great if we could differentiate different errors.

remoteBranches = (
remoteBranchesCache[workspaceId] || (await vcs.getRemoteBranchNames())
).sort();
compare =
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure I have other thoughts on this. I feel much more confident baed on your comment so LGTM

@CurryYangxx CurryYangxx enabled auto-merge (squash) August 9, 2024 02:26
@CurryYangxx CurryYangxx merged commit 8f790bf into develop Aug 9, 2024
7 of 8 checks passed
@CurryYangxx CurryYangxx deleted the feat/offline-commit branch August 9, 2024 08:27
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.

3 participants