Page MenuHomePhabricator

VisualEditor: Link inspector doesn't save changes when closing while XHR is pending
Closed, ResolvedPublic

Description

Introduce artificial delays in your API modules (sleep(2); at the top of ApiOpenSearch::execute() and ApiQueryInfo::execute(); alternatively, you can try this in production if you're quick enough), then perform the following steps quickly:

  1. Inspect an existing link
  2. Change its target
  3. Before the API request completes, close the link inspector by clicking out or clicking the back arrow
  4. Inspect the link again

Expected: new target shows in inspector
Actual: old target shows

With the keyboard it's even weirder:

  1. Inspect an existing link
  2. Type "foo". Wait for the API request to come back and display suggestions
  3. Type "bar" at the end (so you now have "foobar"), then quickly (before the API call comes back) press Enter.
  4. Expected: inspector closes. Actual: input value is reset to "foo"

(At least if you press Enter again, "foo" is actually saved.)

You can work around this and still reproduce the first bug:

  1. Inspect an existing link
  2. Type "foo"
  3. If a suggestion box is displayed (perhaps because "f" was in cache, or because the previous value was in cache), press Esc to dismiss it
  4. Press Enter, the inspector closes
  5. Inspect the link again

Expected: "foo"
Actual: previous value


Version: unspecified
Severity: normal

Details

Reference
bz62818