Skip to content

feat(sync): support offline commit- [INS-4226]#7811

Merged
CurryYangxx merged 2 commits intodevelopfrom
feat/offline-commit
Aug 9, 2024
Merged

feat(sync): support offline commit- [INS-4226]#7811
CurryYangxx merged 2 commits intodevelopfrom
feat/offline-commit

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 force-pushed the feat/offline-commit branch from 5a844b4 to 0c5999d Compare August 6, 2024 02:26
@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.

@CurryYangxx CurryYangxx requested review from gatzjames and ihexxa August 8, 2024 04:22
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 force-pushed the feat/offline-commit branch from 7cf80e6 to 04a2cce Compare August 9, 2024 02:25
@CurryYangxx CurryYangxx enabled auto-merge (squash) August 9, 2024 02:26
@CurryYangxx CurryYangxx disabled auto-merge August 9, 2024 08:13
@CurryYangxx CurryYangxx merged commit 8f790bf into develop Aug 9, 2024
@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