sal0max / grav-plugin-shortcode-gallery-plusplus

A Shortcode extension to add sweet galleries with a lightbox to your Grav website.
MIT License
33 stars 8 forks source link

Gallery style is lost when the page is reloaded #2

Closed beamaria closed 3 years ago

beamaria commented 3 years ago

Update: i found the problem: cache in frontmatter must be disabled

I like your beautiful - and easy to implement!! - gallery. Just a strange behaviour: when you create the gallery and see it in the preview everything is working fine, but as soon as you reload the page you have all the images displayed in a list. The only way to have the correct display back is to clean the cache in GPM. Working in local environment with the latest version of Grav and admin panel (updated today)

before after

sal0max commented 3 years ago

Thanks a lot for opening this issue. I didn't run into the problem, as I had page caching disabled. Good catch!

Seems like the problem is known: https://discourse.getgrav.org/t/plugins-and-caching/6795/9 However, there also seems to be no real solution to the issue. Just some hacky workarounds.

I will see what I can do to remedy this situation.

sal0max commented 3 years ago

Fixed in c743188b034fef07fb803b55f15f8303a37ad2bd. An update should soon be available via the admin panel.

Please verify the fix and close this issue, if it worked.

sal0max commented 3 years ago

Did you find some time to test the updated version, @beamaria ? 😗

beamaria commented 3 years ago

Sorry, the issue is still there; if you don't disable the cache, the pictures are stacked...

sal0max commented 3 years ago

Mh, which version of the plugin do you use? I can't replicate the issue.

beamaria commented 3 years ago

Version 1.0.3 with Grav 1.7.7

I found the way to replicate the issue: In advanced tab of the page put the tick beside caching and enable it: this way the images are stacked on reloading. If you don't have the tick, the issue is gone. (see attachments)

Issue

issue

NO issue--> OK

NO issue

Il giorno 24 feb 2021, alle ore 19:57, sal0max notifications@github.com ha scritto:

Mh, which version of the plugin do you use? I can't replicate the issue.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sal0max/grav-plugin-shortcode-gallery-plusplus/issues/2#issuecomment-785334193, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACZG6TSZSEP7FXLNUMGBKVTTAVK2NANCNFSM4XIYZI3Q.

sal0max commented 3 years ago

Alright, that helps. :)

There are two Cache settings:

  1. Configuration / System / Caching / Caching
  2. Pages / \<Page> / Advanced / Caching This sets cache_enable: true in a pages frontmatter and has to be set for every page.

If only the first is set enabled, there's no problem since after my fix. However, if both caching options are enabled, I can replicate the behavior. Thanks for the clarification.


I couldn't find a way to overwrite the second configuration. However, I don't think that is a real issue. The cache enabling is done actively by an user.

So.. as I can't find a way to remedy this scenario, and the behavior only happens if a user manually enables caching on a page (which probably is rare), I will close this issue for now.

If someone else has an idea, be welcome to comment here.