Page MenuHomePhabricator

HotCat doesn't load after saving a page in VisualEditor (must refresh/reload first) [AOI]
Closed, ResolvedPublic5 Story Points

Description

Steps to reproduce:

  1. Enable HotCat.
  2. Edit the page (any page containing categories) in VisualEditor.
  3. Save the page.
  4. Scroll to the bottom and notice that HotCat's buttons are missing.

Workaround: Re-load the page.

https://en.wikipedia.org/wiki/Wikipedia:HotCat - HotCat documentation

Event Timeline

Whatamidoing-WMF raised the priority of this task from to Medium.
Whatamidoing-WMF updated the task description. (Show Details)
Whatamidoing-WMF added a project: VisualEditor.
Whatamidoing-WMF added a subscriber: Whatamidoing-WMF.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 21 2015, 11:21 PM

Are there any error messages displayed in the browser's console when this happens?

(I originally filed this bug on en-Wiki)
No console message is displayed, when I save the article (Windows XP, FF 38). But when I started the editing session with VE earlier, and it was loading the article ("Hockenheim" on en-Wiki), I noticed the following error in FF console:

"Exception in store-localstorage-update:" load.php:177:752
"NS_ERROR_DOM_QUOTA_REACHED: Persistent storage maximum size reached" DOMException [NS_ERROR_DOM_QUOTA_REACHED: "Persistent storage maximum size reached"
code: 1014
nsresult: 0x805303f6
location: https://en.wikipedia.org/w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=XAzQDrxo:175]

It may be only a local problem on my (old) PC, but thought I'd mention it.

Confirmed in Firefox 38, Ubuntu.
There are no relevant messages in webconsole. (@GermanJoe: Just FYI: that "localstorage" exception is related to ResourceLoader in Firefox, and will appear on every page. It's being worked on, but is unrelated to this. :) )

Quiddity updated the task description. (Show Details)Jun 23 2015, 5:12 AM
Quiddity set Security to None.
TheDJ added a subscriber: TheDJ.Aug 8 2015, 10:30 AM

The Gadget only loads on 'document ready'. It's thus not compatible with VE, since VE redraws the categories. This should be fixed, by introducing hooks for these page sections like described in T53583, and then patching both Visual Editor and HotCat to make use of those hooks.

kaldari renamed this task from HotCat doesn't load after saving a page in VisualEditor (must refresh/reload first) to [AOI] HotCat doesn't load after saving a page in VisualEditor (must refresh/reload first).Aug 25 2015, 1:25 AM
kaldari added a project: Community-Tech.
kaldari moved this task from Untriaged to Blocked on the Community-Tech board.

From the Community Tech sprint kick-off meeting:
Support: Medium/Low (compared to other AOI tasks)
Feasibility: Medium
Impact: Low (users can always reload the page to work around the bug)
Risk: Medium (anything involving VisualEditor has some risk involved)

Priority: Low

kaldari lowered the priority of this task from Medium to Low.Aug 25 2015, 6:32 PM
kaldari moved this task from Blocked to Ready on the Community-Tech board.
kaldari updated the task description. (Show Details)Aug 26 2015, 12:14 AM

May be able to use the following hook:

mw.hook( 'postEdit' ).add(

// reload HotCat

);

Keep in mind this is also fired after a save in the WikiText editor, so we should be careful not to load 2 HotCat interfaces.

kaldari edited a custom field.Sep 14 2015, 6:29 PM
DannyH renamed this task from [AOI] HotCat doesn't load after saving a page in VisualEditor (must refresh/reload first) to HotCat doesn't load after saving a page in VisualEditor (must refresh/reload first) [AOI].Oct 28 2015, 7:06 PM
kaldari claimed this task.Oct 30 2015, 10:12 PM
kaldari moved this task from Ready to In Development on the Community-Tech-Sprint board.

I can get HotCat to reload when the postedit hook fires by adding the following into HotCat:

mw.hook( 'postEdit' ).add( function () { initialized = false; HotCat.started = false; run(); } );

However, when HotCat reloads after VE has recreated the page, it doesn't actually add the HotCat interface to the categories. Either something must be different about the page or there's a timing issue. Will require more investigation.

kaldari closed this task as Resolved.Nov 2 2015, 7:47 PM

Fixed on Commons (and all wikis that import HotCat from Commons):
https://commons.wikimedia.org/w/index.php?title=MediaWiki%3AGadget-HotCat.js&type=revision&diff=177770170&oldid=175827500

Note that there is still an edge case that is broken, but this is due to a VE bug rather than a HotCat bug: T117455

TheDJ added a comment.Nov 2 2015, 8:45 PM

ehm, but postEdit is not the appropriate hook of course.
I'm not really in favor af abusing hooks for purposes that they were not intended for...

ehm, but postEdit is not the appropriate hook of course.

Why is postEdit not appropriate, and what would be a better hook to use?

DannyH moved this task from Untriaged to Archive on the Community-Tech board.

Switched HotCat to use wikipage.content hook instead (which works for null edits as well):
https://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&diff=prev&oldid=190032143

Perhelion added a subscriber: Perhelion.EditedOct 7 2017, 11:59 AM

@kaldari It seems your previous fix was the better one as you said:

Risk: Medium (anything involving VisualEditor has some risk involved)

Now there are direct related bugs through this fix: T151056 T170748 and probably T147197 too.

Restricted Application added a project: User-Ryasmeen. · View Herald TranscriptOct 7 2017, 11:59 AM