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

fix: Ensure WebsocketPolyfill always has the latest session state and version #6217

Merged
merged 1 commit into from
Aug 19, 2024

Conversation

juliusknorr
Copy link
Member

@juliusknorr juliusknorr commented Aug 16, 2024

Steps to reproduce

  • Have an active sync session
  • Block requests to /sync with 401
  • Wait for push to fail and have no version

What happened

If the sync request was failing and the websocket polyfill was reinitialized there was no event emitted by the syncService to set the current session state, version on the new instance again. This lead to push requests missing the current version in the request data.

@juliusknorr juliusknorr force-pushed the fix/version-missing-push branch from fa8b1a5 to e949dbc Compare August 16, 2024 15:06
@juliusknorr juliusknorr force-pushed the fix/version-missing-push branch from e949dbc to 0d78119 Compare August 16, 2024 15:28
Copy link
Member Author

@juliusknorr juliusknorr left a comment

Choose a reason for hiding this comment

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

A few comments to hopefully make the changes more clear

@@ -566,7 +566,7 @@ export default {
},

onSync({ steps, document }) {
this.hasConnectionIssue = !this.$providers[0].wsconnected || this.$syncService.pushError > 0
this.hasConnectionIssue = this.$syncService.backend.fetcher === 0 || !this.$providers[0].wsconnected || this.$syncService.pushError > 0
Copy link
Member Author

Choose a reason for hiding this comment

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

This callback is triggering for either a successful sync or push request so we need this as a workaround way to check if the other request currently has issues.

syncService.open({ fileId, initialSession })

syncService.open({ fileId, initialSession }).then((data) => {
if (syncService.hasActiveConnection) {
Copy link
Member Author

Choose a reason for hiding this comment

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

I decided to refactor this slightly as we then can just always rely on the open method to return the relevant data, in both first connects and reconnects

@juliusknorr juliusknorr added the bug Something isn't working label Aug 19, 2024
@juliusknorr juliusknorr merged commit a9e6ea2 into main Aug 19, 2024
61 of 63 checks passed
@juliusknorr juliusknorr deleted the fix/version-missing-push branch August 19, 2024 13:13
@juliusknorr
Copy link
Member Author

/backport to stable30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants