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

Detect when ReferenceField query fails #3451

Closed
fzaninotto opened this issue Jul 24, 2019 · 2 comments
Closed

Detect when ReferenceField query fails #3451

fzaninotto opened this issue Jul 24, 2019 · 2 comments
Assignees

Comments

@fzaninotto
Copy link
Member

Problem

ReferenceField dispatches a CRUD_GET_MANY_ACCUMULATE action on load and subscribes to the store where the reference is supposed to be recorded. Until the store contains the reference, ReferenceField displays a loader. That's optimistic rendering at work.

The problem is: if the dataProvider fails, the store is never updated, and the loaded indicator is never cleared. It is troubling for both developers and end users.

Solution

We could update the aggregate saga to fix this: each CRUD_GET_MANY_ACCUMULATE action would contain a callback side effect to update the loading state on error, and the aggregate saga would also accumulate these callbacks and execute them all.

To be done in v3 because the code has changed so much for ReferenceFields that we'd need to develop it twice.

@m4theushw
Copy link
Contributor

m4theushw commented Aug 8, 2019

Just to make sure I am on the right path. I modified the crudGetManyAccumulate to receive a callback and pass it to crudGetMany as an onFailure callback. In the useReference I will have an error flag that is updated when the failure callback is fired. If it is ok I will open a PR.

@fzaninotto
Copy link
Member Author

Fixed by #3550

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants