Skip to content

[Bugfix:Forum] Fix Firefox thread edit alert#12472

Merged
bmcutler merged 7 commits intoSubmitty:mainfrom
Akarshkushwaha:bugfix-firefox-thread-lock-error
Mar 10, 2026
Merged

[Bugfix:Forum] Fix Firefox thread edit alert#12472
bmcutler merged 7 commits intoSubmitty:mainfrom
Akarshkushwaha:bugfix-firefox-thread-lock-error

Conversation

@Akarshkushwaha
Copy link
Contributor

@Akarshkushwaha Akarshkushwaha commented Feb 23, 2026

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 an edit_thread event triggering [socketNewOrEditThreadHandler()] to fire an AJAX request. Firefox aggressively aborts this background AJAX request during the page unload, setting jqXHR.status to 0. The previous [error] callback had no guard for this case and unconditionally called window.alert(), interrupting the reload.

What is the New Behavior?

  • The AJAX error callback in [socketNewOrEditThreadHandler] now silently returns if textStatus === 'abort' or jqXHR.status === 0, which are signatures of a request cancelled during Firefox navigation.
  • Replaced window.alert() with the standard Submitty [displayErrorMessage()] for genuine errors, which provides a better user experience.

Before:
image

After:
image

What steps should a reviewer take to reproduce or test the bug or new feature?

  1. Open Submitty in Firefox and log in as an instructor.
  2. Navigate to the Discussion Forum and open any thread that has a Lock Thread Date set.
  3. Click the three dots () on the first post → Edit.
  4. Click Update Post without changing anything.
  5. Before this fix: A "Something went wrong" alert will appear and pause the reload.
  6. After this fix: The page reloads cleanly with no alert.

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

  • Not a breaking change.
  • No migrations required.
  • No security concerns.

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.
@Akarshkushwaha Akarshkushwaha force-pushed the bugfix-firefox-thread-lock-error branch from 478d28d to 4420066 Compare February 23, 2026 18:22
@Akarshkushwaha
Copy link
Contributor Author

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!

Copy link
Member

@williamjallen williamjallen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Akarshkushwaha Please remove the extraneous whitespace and conflict markers.

@github-project-automation github-project-automation bot moved this from Seeking Reviewer to Work in Progress in Submitty Development Feb 24, 2026
@automateprojectmangement automateprojectmangement bot moved this from Work in Progress to In Review in Submitty Development Feb 24, 2026
@Akarshkushwaha Akarshkushwaha changed the title [Bugfix:Forum] Fix Firefox edit error & Vue TS build [Bugfix:Forum] Fix Firefox false-positive alert on thread edit Feb 24, 2026
Copy link
Contributor

@JManion32 JManion32 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-project-automation github-project-automation bot moved this from In Review to Work in Progress in Submitty Development Feb 26, 2026
@automateprojectmangement automateprojectmangement bot moved this from Work in Progress to In Review in Submitty Development Feb 28, 2026
@Akarshkushwaha
Copy link
Contributor Author

Akarshkushwaha commented Feb 28, 2026

@JManion32 Thanks for the review I've reverted the unintended whitespace/indentation changes as requested.

Copy link
Member

@williamjallen williamjallen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code seems reasonable to me.

@williamjallen
Copy link
Member

@Akarshkushwaha Please see the failing PR title check.

@codecov
Copy link

codecov bot commented Mar 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 21.66%. Comparing base (2049e38) to head (2067683).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            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           
Flag Coverage Δ
autograder 21.39% <ø> (ø)
js 2.04% <ø> (ø)
migrator 100.00% <ø> (ø)
php 20.68% <ø> (ø)
python_submitty_utils 80.08% <ø> (ø)
submitty_daemon_jobs 91.13% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Akarshkushwaha Akarshkushwaha changed the title [Bugfix:Forum] Fix Firefox false-positive alert on thread edit [Bugfix:Forum] Fix Firefox thread edit alert Mar 1, 2026
Copy link
Contributor

@JManion32 JManion32 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI passes, code changes are reasonable, and the issue has been resolved. Nice work!

@github-project-automation github-project-automation bot moved this from In Review to Awaiting Maintainer Review in Submitty Development Mar 4, 2026
@bmcutler bmcutler merged commit fc6e86c into Submitty:main Mar 10, 2026
26 checks passed
@github-project-automation github-project-automation bot moved this from Awaiting Maintainer Review to Done in Submitty Development Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

error is displayed on firefox when changing thread lock date

4 participants