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: RealTimeQueries component #742

Merged
merged 2 commits into from
Jul 27, 2020
Merged

feat: RealTimeQueries component #742

merged 2 commits into from
Jul 27, 2020

Conversation

y-lohse
Copy link
Contributor

@y-lohse y-lohse commented Jul 21, 2020

This PR brings the RealTimeQueries component from drive to cozy-client, allowing documents of a given doctype to stay up to date through the realtime plugin.

Copy link
Contributor

@ptbrowne ptbrowne left a comment

Choose a reason for hiding this comment

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

LGTM, thanks !

jest.config.js Show resolved Hide resolved
)
)
},
[client]
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that if the callback took client, we could have this whole function outside the component.

dispatchChange(client, document, mutationDefinitionCreator)

And then it would not be necessary to have a useCallback

})

unmount()
expect(client.plugins.realtime.unsubscribe).toHaveBeenCalledTimes(3)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: It'd be nice to be able to check if the realtime doesn't have any listener anymore. Here the 3 is hardcoded and will need to change with the implementation. I don't think that's possible with the realtime current API though.

@y-lohse y-lohse merged commit 2d474ea into master Jul 27, 2020
@y-lohse y-lohse deleted the realtimequeries branch July 27, 2020 12:43
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