HomePhabricator

[explorer] Prevent datatables ajax error popup

Description

[explorer] Prevent datatables ajax error popup

Summary:
When DataTables fails to populate a table with data from the server API, it triggers a pop-up with a user-unfriendly error msg. Reloading the page will usually correct the error. However the user is not informed of this.

Implement custom error handling function instead of this default datatables behavior. When we experience a datatables error, we reload the page (without params, in case the user was trying to load e.g. http://localhost:3035/?rows=1000 which is expected to fail as the API will not provide this many blocks).

If this fails to solve the issue, next step would be to get the required data manually from an API call -- where we can control the try...catch behavior -- then load the table only when we have good data, e.g. https://datatables.net/examples/data_sources/js_array.html

Test Plan: This diff definitely ends the behavior of "unhelpful datatables popup." I am not sure if the auto-reload-on-error behavior will work in practice or not, as I am not able to reliably recreate the datatables error on load with no params. However, I was able to test this behavior by intentionally throwing the error, e.g. http://localhost:3035/?rows=1000 after setting MAX_ROWS_RENDER to > 1000 -- page just reloads quickly to home, no issue detectable by user.

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D16640

Details

Provenance
bytesofmanAuthored on Aug 13 2024, 18:31
bytesofmanPushed on Aug 13 2024, 20:40
Reviewer
Restricted Project
Differential Revision
D16640: [explorer] Prevent datatables ajax error popup
Parents
rABC65ca02e1ecf9: Let mapNextTx store shared pointers instead of raw pointers
Branches
Unknown
Tags
Unknown