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

Backwards compatibility for table() and view() #1384

Merged
merged 1 commit into from
Apr 20, 2021
Merged

Backwards compatibility for table() and view() #1384

merged 1 commit into from
Apr 20, 2021

Conversation

sc1f
Copy link
Contributor

@sc1f sc1f commented Apr 19, 2021

#1289 was a breaking change for the Perspective API, as it made Table and View constructors async by returning a Promise to the Table or View instance instead of the instance itself. Internally, the constructors would wait on the server (across the websocket or a web worker) to return a message that signaled successful Table/View creation. However, when running a Perspective client that is newer than the Perspective server, older versions of the server (i.e. all released versions right now, as the async table/view changes are not in a tagged release yet) will not return the acknowledgement message and thus Table and View constructors will block forever.

To maintain backwards compatibility, this PR adds a simple feature flag implementation on both the client and server, which allows newer versions of Perspective to run against older versions on the server. In the init message used to begin client/server communication, the server returns an array of strings that represent enabled features, and the client will use those flags to determine its behaviour.

Currently, only one flag (wait_for_response) is implemented - if the flag is present, then the Table and View constructors will wait for an acknowledgement message from the server. If the flag is not present, or if there are no feature flags at all, then the constructors will resolve() immediately, thus preserving compatible behaviour between different versions.

@sc1f sc1f added enhancement Feature requests or improvements JS labels Apr 19, 2021
@sc1f sc1f added this to the 0.7.0 milestone Apr 19, 2021
@sc1f sc1f marked this pull request as ready for review April 19, 2021 22:51
Copy link
Member

@texodus texodus left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for the PR!

@texodus texodus merged commit 6d72daf into master Apr 20, 2021
@texodus texodus deleted the backwards branch April 20, 2021 07:18
@texodus texodus added internal Internal refactoring and code quality improvement and removed enhancement Feature requests or improvements labels Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Internal refactoring and code quality improvement JS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants