Page MenuHomePhabricator

Allow scripts to pause/"restart" EditRecovery
Open, LowPublicFeature

Description

Feature summary:

  • A JS function, exposed through a global or hook, that pauses the saving of the data by EditRecovery.
    • Alternatively: a mw.config boolean the fieldChangeHandler checks before it executes itself.
  • A JS function, exposed through a global or hook, that instructs EditRecovery to reconstruct the originalData the form is compared against when it's modified.

Use case(s):
I have a script that saves the page through the edit API while action=edit is open, so that I can continue editing without navigating back and forth. Since the introduction of EditRecovery, every time I start editing a page last saved with this method, "Changes recovered" pops up, which is completely useless because the "recovered" data has already been saved.

Benefits:
Better access to EditRecovery allows gadget/script developers and users to fine-tune its behavior.

Event Timeline

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

Would the addition of the user preference be helpful here?

Would the addition of the user preference be helpful here?

No, there needs to be a way to turn off the edit recovery after it's been loaded, whereas unchecking the preference just prevents the module from being loaded in the first place.

@Nardog I see the value of this for users who run scripts, but given that this is such a nascent feature, I'm going to put this feature optimization in our backlog.

One way to mitigate the problem is to make EditRecovery compare the current form values against the defaultValues instead of keeping an originalData object. That way a script would be able to modify the defaultValues to "reset" EditRecovery.