WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#33954 closed defect (bug) (fixed)

Remove unused instances of wpview

Reported by: azaozz Owned by: iseulde
Milestone: 4.4 Priority: normal
Severity: normal Version: 4.2
Component: TinyMCE Keywords: has-patch fixed-major
Focuses: Cc:

Description

There may be unused instances of wpviews in some cases. For example when we check an URL on its own line, we add "markers" and create an instance. Then we do AJAX request to try to embed it. If it is not embeddable, we remove the markers but the instance remains.

Attachments (2)

33954.patch (908 bytes) - added by azaozz 6 years ago.
33954.2.patch (776 bytes) - added by iseulde 6 years ago.

Download all attachments as: .zip

Change History (11)

@azaozz
6 years ago

#1 @iseulde
6 years ago

This is partly intentional and designed like this since the beginning. When a view is removed, the instance remains so it can be reused if it's created again (meaning no server request). Of course, if it is not embeddable, maybe there's not much point in caching it, though it would be useful if the user tries to embed again (so caching both successes and errors).

#2 @wonderboymusic
6 years ago

  • Owner set to iseulde
  • Status changed from new to assigned

#3 @iseulde
6 years ago

  • Keywords needs-patch added
  • Version changed from 4.3 to 4.2

When an instance is reused for a non embeddable URL, the marker is not removed after using the cached response (so it is the first time, not any time after). This needs a fix.
We need to keep responses however, even failures, as there would be new server requests every time the DOM refreshes or when switching between text and visual. The DOM refreshes are the most important though, it triggers for example every time you undo or redo something.

#4 @iseulde
6 years ago

  • Status changed from assigned to accepted

@iseulde
6 years ago

#5 follow-up: @iseulde
6 years ago

  • Keywords has-patch added; needs-patch removed

33954.2.patch: Keep the instance but mark it to be ignored when parsing the content to avoid more requests.

This ticket was mentioned in Slack in #core-editor by iseulde. View the logs.


6 years ago

#7 in reply to: ↑ 5 @azaozz
6 years ago

Replying to iseulde:

Yep, that works better :)

#8 @iseulde
6 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 35216:

TinyMCE: make sure markers are removed after first init

This is only relevant to non embeddable URLs.
After first init, markers were set but not removed,
causing an edited URL to revert when switching to text mode
or any paragraph after the URL to just contain that URL.

Fixes #33954.

#9 @iseulde
6 years ago

  • Keywords fixed-major added

Reopening for previous releases.

Note: See TracTickets for help on using tickets.