Catch analytics tracking error during maintenance mode
When developing locally in maintenance mode, users would be [presented with a javascript error](Relates to #499327 (closed)) which seems to have been caused by a POST request for usage tracking data. The request failed due to the url not being in the allowlist of requests during maintenance mode.
This MR catches/silences the JS error to avoid displaying the webpack error page.
A decision on allowing the POST request through in maintenance mode is still being discussed here.
Changelog: fixed
Screenshots
| Before | After |
|---|---|
![]() |
![]() |
How to set up and validate locally
- Remove/comment the added code from this MR -
.catch(() => {});inapp/assets/javascripts/api.js - Turn on maintenance mode via the Maintenance Mode section on the Admin > Settings > General settings page at /admin/application_settings/general
- Refresh the Admin page and click anywhere to trigger a tracking event - you should observe a webpack error on the page, and in the browser console
- Uncomment the code mentioned in step 1
- Refresh the Admin page again and try to click anywhere, the error should no longer be present, but will still be logged in the browser developer console
Related to #499327 (closed)
Edited by Scott Murray

