Page MenuHomeYugipedia

Null-editing a page using the "Null edit button" gadget causes all images to disappear until the page is refreshed
Closed, InvalidPublic

Description

Probably the lazy image loader and the gadget don't play well together. (cc @corey and @Becasita)

Event Timeline

The gadget sends a POST request to edit the page without modifying it. Then, with an AJAX request I GET the page content and replace the #bodyContent with the fetched content. After that, the script fires the "wikipage.content" hook. That's how I make sure that the JS is re-fired to allow, for instance, collapsible stuff to remain collapsible (else, it would be static).
If possible, the lazy loader script needs to load the images when the hook is fired.

Corey will have to confirm, but I believe that the lazy loader script only loads images when they're scrolled into the browser's viewport, so loading them immediately when wikipage.content fires would be inappropriate. Possibly the way to fix this would be for the lazy loader's state to reset instead.

corey added a comment.Oct 13 2018, 2:10 AM

Yeah, the extension only loads images once they're within the browser's viewport (otherwise it wouldn't be truly lazy 😛).

I've never dealt with MediaWiki's mw.hook JS function, @Becasita. Does it trigger extensions the same way Hooks::run(); does? If so, then it shouldn't be too much of an issue to rewrite the script to re-execute when the wikipage.content hook is fired.

Thinking about this a bit more, there's no real reason to require already-loaded images to be reloaded in this case, if there's any way to just pull them from the user's local cache (though if this is done, there should be a way to tell the extension to reload the images regardless, I guess).

I don't know if it's the same as Hooks::run();. Would have to check the docs.
But Dino's approach seems better.
With a null edit, the images don't need to be reloaded (supposedly).

Dinoguy1000 closed this task as Invalid.Dec 23 2018, 11:34 PM

The lazy image loader was disabled some time ago, so closing this as invalid for now. It can be reopened if the loader is re-enabled and the problem reappears.