Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, this patch allow using ra-realtime on 3.x
The only 2 changes are:
import { LOCATION_CHANGE } from 'react-router-redux';
forimport { LOCATION_CHANGE } from "connected-react-router";
And get
fetchType
from the action type, and not action payloadmeta.fetch
, because even if it exists onhttps://github.com/marmelab/react-admin/blob/master/packages/ra-core/src/actions/dataActions/crudGetList.ts
https://github.com/marmelab/react-admin/blob/master/packages/ra-core/src/actions/dataActions/crudGetOne.ts
it is not present on the actual payload, as you can see on the console output on the example below.
I made this as a draft on 2.x because it was easier and didn't know if you want this on 3.x branch or prefer that i create a new repo for it. If you want this on 3.x, i create a new, non-draft pull request on it, and converted to TypeScript.
Commenting #3908, i agree that the actual approach is not optimal, one reason is that for example, with graphql subscriptions or firebase realtime db/firestore, it firsts asks a normal, non-realtime request, and right after asks a realtime one, which return the first result very fast and likely the same as the normal request, ending up with one unnecessary request. So, what do you think about allowing dataProviders to return observable requests, likely with a next function on the response object that awaits for new data and then returns it?
Working example (posts list only):
https://codesandbox.io/s/jovial-swirles-gn3un
Working live:
https://gn3un.sse.codesandbox.io/#/posts