Handle rejected sortable request instead of leaving it unhandled - #1301
Handle rejected sortable request instead of leaving it unhandled#1301dg wants to merge 2 commits into
Conversation
Sortable ignores the promise returned from onEnd, so when the sort request failed (network error, or a handler responding with an empty body where Naja expects JSON), the rejection surfaced as an uncaught promise error in the console with no context. The request is now settled in makeSortRequest itself and a failure is logged.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1301 +/- ##
=======================================
Coverage 49.12% 49.12%
=======================================
Files 63 63
Lines 2974 2974
=======================================
Hits 1461 1461
Misses 1513 1513 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR addresses unhandled promise rejections triggered by failed SortableJS sort requests by ensuring the underlying AJAX request is always settled within makeSortRequest, and logging failures for visibility.
Changes:
- Wraps
datagrid.ajax.request(...)with handlers so its rejection is consumed even when SortableJS ignores the returned promise. - Logs an error when the sort request fails to avoid silent/uncontextualized failures in the console.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Thanks — the unhandled rejection is a real problem. Two things I'd like to think through before merging. 1.
|
Sortable ignores the promise returned from onEnd, so when the sort request failed (network error, or a handler responding with an empty body where Naja expects JSON), the rejection surfaced as an uncaught promise error in the console with no context. The request is now settled in makeSortRequest itself and a failure is logged.