vesta-webtrees-2-custom-modules / vesta_personal_facts

⚶ Vesta Facts and events (Webtrees 2 Custom Module)
https://cissee.de/
GNU General Public License v3.0
8 stars 3 forks source link

First show text, then show pictures #99

Open SnarfW opened 3 weeks ago

SnarfW commented 3 weeks ago

I have quite a number of media objects in my tree. Because of these images (in combination with maybe not the fastest server) I do see a difference between your module and the 'standard' personal facts and events module: In the 'webtrees original' personal facts and events module, first the text is loaded and then the images. (So the page is slowly build up when a lot of images are attached to the person). In your custom module both are shown at the same time, and only after the thumbnails of the images have been generated. Therefor for a page with several images it can take quite a while before any information is shown.

Would it be possible to implement the same behaviour as in the original/standard module: immediately show the text and then slowly show the images?

ric2016 commented 3 weeks ago

I can reproduce this by adding a delay in MediaFileThumbnail.php.

It is caused by the flag "canLoadAjax", which is set to true to the Vesta tab (in order to avoid unnecessary requests when the tab isn't actually displayed), but not for the original tab. I'm not sure about the best way to fix this.

Tabs loaded via ajax are apparently only displayed once they are fully ready (see comment here).

Does it help if you remove (or comment out) lines 46 and 50 in this file (keeping the lines in between)?

Alternatively, setting "canLoadAjax" to true here should also help (but break other things according to the comment there), but I'd prefer to offer the first workaround as an option (or change to that in general).

SnarfW commented 3 weeks ago

First of all, thank you for looking into this. Much appreciated!

While testing your suggestions, I noticed that the "delay" is only observed when I log in. For visitors, I observe the same with you module as in the webtrees "standard". Text is immediately shown and images are shown later.

I tried your suggestions: ) Removed line 46 and 50: this did not have any effect ) I might have misunderstood you, but the "canLoadAjax" was already set to true. When I set this to false, I do see that text is shown immediately and the images later (both when logged in or as visitor). I have only tested this shortly, but did not yet observe any unwanted effect.

ric2016 commented 2 weeks ago

Removed line 46 and 50: this did not have any effect

That is a bit unexpected, it seemed to help in my setup.

Anyway - I'll probably just add an option to disable the ajax loading of the tab (the families tab already has this option).