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

JS models loading state and error handling consistency #2247

Merged
merged 5 commits into from Jul 25, 2019
Merged

JS models loading state and error handling consistency #2247

merged 5 commits into from Jul 25, 2019

Conversation

noirbizarre
Copy link
Contributor

This PR ensure that every JS model:

  • set the loading flag to true on fetch/save/update (and so widgets properly display a spinner)
  • save/update methods always accept an optional error handler
  • save/update methods always handle errors, even when no error handler is provided

The provided default error handler ensures:

  • the loading state is set back to false (prevent infinite spinning on widgets)
  • in the absence of a provided error handler that:
    • the error is submitted to Sentry if necessary (when there was no server side error handled by Sentry) and so notified to the user using the global Sentry handler
    • the error is logged as error in the JS console as fallback

To improve the console fallback, a feedback pubsub needs to be implemented allowing views to listen on model errors and then notify the user.

This implements/fixes #2245 and ensures datagouv/data.gouv.fr#133 fix (#2246) does not get stuck on the spinner instead of properly display the form error

@noirbizarre noirbizarre merged commit 276ea5a into opendatateam:master Jul 25, 2019
@noirbizarre noirbizarre deleted the gh2245-js-models-loading-error branch July 25, 2019 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JS models fetch/loading/success/error inconsistencies
2 participants