Commit graph

8 commits

Author SHA1 Message Date
Pierre de La Morinerie
4f33a7b72e js: improve auto-save-controller documentation 2021-09-07 16:45:52 -05:00
Pierre de La Morinerie
ad8dcc7f7d js: don't report autosave failures that are timeouts
This prevents spamming Sentry with "[Autosave] Error: 0" messages.
2021-09-07 16:45:52 -05:00
Pierre de La Morinerie
7380d27d78 js: fix null xhr in autosave error handling
Sentry reports many cases of the xhr object being missing in the
error handler.

Ensure the error handling code doesn't crash because of the missing xhr.
2021-08-31 14:54:02 -05:00
Pierre de La Morinerie
e1909ed29f brouillon: redirect to sign-in when disconnected
There are two cases where the draft auto-save might fail because the
user is no longer authenticated:

- The user signed-out in another tab,
- The brower quit and re-opened, so the Session cookie expired.

In both cases, the auto-save will never succeed until the user
authenticates again, so displaying a "Retry" button is cruel.

Moreover, in plus of all auto-save requests failing with a small error,
the actual hard failure only occurs after filling all the form and
trying to submit it. Then the user is redirected to the sign-in page –
but all their changes are lost.

Instead, we now redirect to the sign-in page on the first 401 error
during the auto-save, let the user sign-in, and then redirect back to
the form.
2021-07-22 11:58:02 +02:00
Pierre de La Morinerie
ecc4f01c20 autosave: trigger an autosave after removing a row 2020-08-25 15:45:49 +02:00
Pierre de La Morinerie
e157a289e1 autosave: factorize some javascript code 2020-08-25 14:39:34 +02:00
Paul Chavard
43a1ead1cb fix new prettier defaults 2020-05-12 18:18:37 +02:00
Pierre de La Morinerie
e908b42b43 javascript: move the autosave files to a sub-directory 2020-03-23 14:02:29 +01:00
Renamed from app/javascript/new_design/autosave.js (Browse further)