[Bugfix:Forum] Fix Firefox thread edit alert#12472
Conversation
This commit corrects a bug where Firefox would trigger a false-positive 'Something went wrong' alert when saving thread lock dates. Firefox aggressively terminates parallel WebSocket AJAX requests (status 0) during page reloads, which previously tripped the error listener. Additionally, this commit also removes conflicting 'defineProps' imports across 6 Vue components that were breaking the production frontend build.
478d28d to
4420066
Compare
|
Hi @williamjallen @bmcutler I've opened PR #12472 to fix this. The root cause is Firefox aggressively aborting WebSocket-triggered AJAX requests during page reloads, which incorrectly fired the error alert. The fix silently ignores those aborted requests. Please take a look when you get a chance! |
williamjallen
left a comment
There was a problem hiding this comment.
@Akarshkushwaha Please remove the extraneous whitespace and conflict markers.
JManion32
left a comment
There was a problem hiding this comment.
Thank you for your thorough description, it made it very easy to test this change. Functionally, this solves the issue. I will approve once the whitespace changes I indicated are reverted.
|
@JManion32 Thanks for the review I've reverted the unintended whitespace/indentation changes as requested. |
williamjallen
left a comment
There was a problem hiding this comment.
Code seems reasonable to me.
|
@Akarshkushwaha Please see the failing PR title check. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12472 +/- ##
=========================================
Coverage 21.66% 21.66%
Complexity 9638 9638
=========================================
Files 268 268
Lines 36233 36233
Branches 486 486
=========================================
Hits 7849 7849
Misses 27902 27902
Partials 482 482
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
JManion32
left a comment
There was a problem hiding this comment.
CI passes, code changes are reasonable, and the issue has been resolved. Nice work!
Why is this Change Important & Necessary?
Fixes #11535
On Firefox, editing a thread that has a lock date causes a false-positive "Something went wrong when adding new thread. Please refresh the page." alert to appear. The page then reloads anyway and the update saves correctly.
The root cause is a race condition: when the user submits an edit, [modifyOrSplitPost()] calls
window.location.reload(), while simultaneously the WebSocket server broadcasts anedit_threadevent triggering [socketNewOrEditThreadHandler()] to fire an AJAX request. Firefox aggressively aborts this background AJAX request during the page unload, settingjqXHR.statusto0. The previous [error] callback had no guard for this case and unconditionally calledwindow.alert(), interrupting the reload.What is the New Behavior?
textStatus === 'abort'orjqXHR.status === 0, which are signatures of a request cancelled during Firefox navigation.window.alert()with the standard Submitty [displayErrorMessage()] for genuine errors, which provides a better user experience.Before:

After:

What steps should a reviewer take to reproduce or test the bug or new feature?
Automated Testing & Documentation
No automated tests exist for this specific frontend race condition behavior.
This was manually verified on Firefox (v135) on Linux.
No documentation update is required for this bug fix.
Other information