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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin communication back to app is failing on Android #1142

Closed
salockhart opened this issue May 7, 2020 · 3 comments
Closed

Plugin communication back to app is failing on Android #1142

salockhart opened this issue May 7, 2020 · 3 comments

Comments

@salockhart
Copy link

馃悰 Bug Report

I have installed flipper-plugin-react-query-native-devtools, which allows me to view the react-query query cache at any time. It also allows refetching and removing queries as necessary

Here is an example repo: https://github.com/salockhart/FlipperReactQueryDemo

When running the app on iOS, I can make a request and then use Flipper to refetch or remove the query. When running the app on Android, tapping the buttons in Flipper doesn't do anything. Adding some console logs seems to show that the message is never making it to the app.

To Reproduce

  1. Open the above example repo
  2. Run on iOS and Android
  3. In Flipper, open the react-query-native-devtools plugin and attempt to refetch queries

Environment

Flipper Desktop: 0.40.0
Android Emulator: Pixel 3 API 28
iOS Simulator: iOS 11.4.1
react-native-flipper: 0.39.0
react-native" 0.62.2

@salockhart
Copy link
Author

@jknoxville
Copy link
Contributor

Hey @salockhart, thanks for the report.

The issue is here, you're sending a string as the parameters object in client.call(). This isn't supported, it should always be an object, e.g. {queryHash: query.queryHash} rather than just query.queryHash.

It's just a coincidence that it happens to work in the iOS code path because there's one fewer translation layers.

I see that in the API, params is of type any which is pretty misleading. Sorry about that, I'll try and get it fixed.

@salockhart
Copy link
Author

@jknoxville Thanks! That's a great help. I've taken your comments back to the linked issue.

bgaleotti added a commit to bgaleotti/react-query-native-devtools that referenced this issue May 7, 2020
facebook-github-bot pushed a commit that referenced this issue May 7, 2020
Summary:
Fixes #1142

When using `client.call(methodName, params)`, params has to be an object, not, for example a string.

It may work on some client implementations, e.g. iOS, but this is a coincidence and not to be relied on. If this gives you new type errors, the plugin should continue to run in the short term but has no guarantees, please adapt it to conform. You can do this by preserving backwards compatibility by doing a typecheck in your client plugin if necessary.

CHANGELOG: Calling `client.call()` or `client.send()` now fails to type-check if params is not an object, to match client implementations.

Reviewed By: nikoant

Differential Revision: D21450694

fbshipit-source-id: 53db49f874838769e39a94b1c4bd4c0b30ecdbc7
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

No branches or pull requests

2 participants