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

List show nothing when http error after upgraded to v4 #8241

Closed
mytharcher opened this issue Oct 6, 2022 · 4 comments · Fixed by #8319
Closed

List show nothing when http error after upgraded to v4 #8241

mytharcher opened this issue Oct 6, 2022 · 4 comments · Fixed by #8319
Labels

Comments

@mytharcher
Copy link

What you were expecting:

<List> should at least show some normal components when error happens, such as filter, grid (with old data), pagination and others which not cause the error.

What happened instead:

After upgraded to v4, if HTTP error happens, all <List> show nothing like abnormal.

Steps to reproduce:

Something same as in #7415, just return a 500 error from any loading in list.

Related code:

5cc275a

if (error) {
    return null;
}

This logic is so simple and rough to fix the old issue.

Other information:

Environment

  • React-admin version: 4.4.0
  • Last version that did not exhibit the issue (if applicable): 3.19.0
  • React version: 17.0.2
  • Browser: Chrome 105.0.5195.125
  • Stack trace (in case of a JS error):

Console error:

react_devtools_backend.js:4026 Error
    at new HttpError (HttpError.ts:15:1)
    at fetch.ts:50:1

HTTP response:

{"timestamp":1665035231396,"error":{"key":"error.unknown"}}
@slax57
Copy link
Contributor

slax57 commented Oct 7, 2022

Hi, and thank you for submitting this issue.
I agree that this is something that could be improved, for example we could display the data we have, even though the last fetch ended up with an error.
I'll mark this as an enhancement request.
Feel free to open a PR if you would like to submit an improvement for this.

@ishfx
Copy link

ishfx commented Oct 20, 2022

Hi everyone,

For me, this is a bug and not an enhancement.

The filter inputs that caused the backend error are saved to the local storage as specified in the docs :
image

This causes the List page to show nothing because the erroneous filter inputs are always being sent on page load.
The only solution I've found right now is to ask users to clear their cache (and by extension their local storage).
The backend error is completely normal as it reflects an erroneous query.

The desired solution would be to display at least the filter bar, so the users can correct their filter inputs.

Thanks in advance.

@mytharcher
Copy link
Author

@ishfx That is totally correct. And I think the erroneous filter should not be persisted.

@fzaninotto
Copy link
Member

You're right, the fact that we persist filters makes it a bug. Changing the label to reflect that.

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

Successfully merging a pull request may close this issue.

4 participants