Page MenuHomePhabricator

Error when discarding changes with CodeMirror enabled (this.last is null)
Closed, ResolvedPublicBUG REPORT

Assigned To
Authored By
Samwilson
Jan 4 2024, 5:41 AM
Referenced Files
F41662018: T354313_Discard.webm
Jan 9 2024, 11:29 PM
F41661933: 2024-01-09_13-21-12.png
Jan 9 2024, 11:23 PM
F41661931: 2024-01-09_13-20-18.png
Jan 9 2024, 11:23 PM
F41661928: 2024-01-09_13-11-27.png
Jan 9 2024, 11:23 PM
F41661926: 2024-01-09_13-10-16.png
Jan 9 2024, 11:23 PM
F41661924: 2024-01-09_13-08-06.png
Jan 9 2024, 11:23 PM
F41661922: 2024-01-09_13-06-49.png
Jan 9 2024, 11:23 PM
F41661896: T354313_Discard.webm
Jan 9 2024, 11:23 PM

Description

Steps to replicate the issue (include links if applicable):

  • Start editing a page and make some changes.
  • Reload it, to trigger the Edit Recovery notification.
  • Click 'Discard changes'.

What happens?:

The text is reset, but the notification does not close, and the following error is shown in the console:

Uncaught TypeError: this.last is null
    addInner main.js:1
    add main.js:1
    of main.js:1
    set main.js:1
    update main.js:1
    update main.js:1
    applyTransaction main.js:1
    Y main.js:1
    yt main.js:1
    applyTransaction main.js:1
    get state main.js:1
    update main.js:1
    dispatchTransactions main.js:1
    dispatch main.js:1
    setSelection main.js:1
    textSelection jQuery
    loadData edit.js:161
    loadData edit.js:145
    onLoadData edit.js:110
    emit oojs.js:858
    onClick oojs-ui-core.js:2376
    jQuery 9
    setButtonElement oojs-ui-core.js:2316
    OoUiMixinButtonElement oojs-ui-core.js:2258
    OoUiButtonWidget oojs-ui-core.js:3976
    mwWidgetsEditRecoveryLoadNotification LoadNotification.js:11
    onLoadData edit.js:102
    promise callback*onLoadHandler/< edit.js:77
    promise callback*onLoadHandler edit.js:74
    add mediawiki.base.js:519
    js edit.js:17
…

What should have happened instead?:

The text reset, the caret positioned at the top, and the notification closed.

QA Results - Beta

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 987516 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/core@master] Edit Recovery: set caret position when loading form data

https://gerrit.wikimedia.org/r/987516

Change 987516 merged by jenkins-bot:

[mediawiki/core@master] Edit Recovery: set caret position when loading form data

https://gerrit.wikimedia.org/r/987516

@Samwilson When I click Discard changes, there is no error and the notification closes as seen below. This will be moved to Done. Thanks for all your work!

Status: ✅PASS
Environment: Beta: 1.42.0-alpha (db5f768))
OS: macOS Sonoma 14.2.1
Browser: Chrome 120, Firefox 120, Safari 17.2, Edge 120
Skins. Vector 2022, 2010, Minerva, Monobook, Timeless
Device: MBA M2
Emulated Device:: n/a
Test Links:
https://en.wikipedia.beta.wmflabs.org/w/index.php?title=Dog&action=edit

✅AC1: https://phabricator.wikimedia.org/T354313

MinervaMonobookTimelessVectorEsHe
2024-01-09_13-06-49.png (1×2 px, 601 KB)
2024-01-09_13-08-06.png (1×3 px, 1 MB)
2024-01-09_13-10-16.png (1×3 px, 431 KB)
2024-01-09_13-11-27.png (1×3 px, 964 KB)
2024-01-09_13-20-18.png (1×3 px, 675 KB)
2024-01-09_13-21-12.png (1×2 px, 603 KB)