[Bug]: Loading a project the first time → full menu, after reload → correct menu (less buttons due to custom JS)
What is the bug? (in English)
After logging in and loading a repositoty the complete menu is shown. After a refresh of the page the set menu is shown correct.
https://github.com/user-attachments/assets/387742c1-8cc9-4a19-adcf-16b9da1a71d3
Steps to reproduce the issue
Login on Lizmap Load repository Refrech page
Versions, safeguards, check summary etc
Versions :
- Lizmap Web Client : 3.8.7 - commit bee4379f1 https://github.com/3liz/lizmap-web-client/commit/bee4379f1
- Lizmap plugin : 4.4.8
- QGIS Desktop : 3.42.1
- QGIS Server : 3.42.1
- Py-QGIS-Server or QJazz : not used
- QGIS Server plugin lizmap_server : 2.13.0
List of Lizmap Web Client modules :
* Version Lizmap Web Client 3.8 needed
List of safeguards :
* Mode : safe
* Allow parent folder : no
* Prevent other drive : yes
* Prevent PG service : yes
* Prevent PG Auth DB : yes
* Force PG user&pass : yes
* Prevent ECW : yes
Check Lizmap plugin
- [x] I have done the step just before in the Lizmap QGIS desktop plugin before opening this ticket. Otherwise, my ticket is not considered valid and might get closed.
Operating system
Windows11
Browsers
Chrome
Browsers version
Versie 134.0.6998.178 (Officiële build) (64-bits)
Relevant log output
I have the same issue. It seems that some custom java scripts are not loaded first time.
I have the same issue. It seems that some custom java scripts are not loaded first time.
You also using windows?
I have the same issue. It seems that some custom java scripts are not loaded first time.
You also using windows?
Yes
I think I found the solution. At least in my case. I had a media folder in all repositories and in the root. I removed it from the repositories and everything is ok. In the media folder of the repositories there were still old java scripts which were meant for the same purpose.
Why did you reopen ?
Even disabling all Javascript, with &no_user_defined_js=1 in the URL ?
Can you check with F12 and clicking in the menu with the inspector tool, are these buttons in the DOM ?
I guess by "repository", you mean "project" instead ;-)
I did check with the inspector tools and al you describe but there are no buttons in the DOM With repository i measn projects indeed.
But when i disable all java scripts all buttons appears on the menu. Thats why i use the java script to hide some buttons but only when i reload the project.
Hello,
I have exactly the same problem, for example on this interface where custom javascripts seem to launch randomly after refreshing the page. I have the impression that the bug only occurs on Chrome, but not on Firefox. @NvBgm, is it the same for you? Does it bug on Firefox?
Versions :
- Lizmap Web Client : 3.8.6 - commit 50eef0fa5 https://github.com/3liz/lizmap-web-client/commit/50eef0fa5
- Lizmap plugin : 4.4.7
- QGIS Desktop : 3.34.15
- QGIS Server : 3.40.4
- Py-QGIS-Server or QJazz : not used
- QGIS Server plugin atlasprint : 3.4.1
- QGIS Server plugin cadastre : 2.0.1
- QGIS Server plugin lizmap_server : 2.12.0
- QGIS Server plugin wfsOutputExtension : 1.8.2
List of Lizmap Web Client modules :
* cadastre : 2.1.5 * openads : 1.1.2
List of safeguards :
* Mode : safe
* Allow parent folder : no
* Prevent other drive : yes
* Prevent PG service : yes
* Prevent PG Auth DB : yes
* Force PG user&pass : yes
* Prevent ECW : yes
I do not replicate on demo servers :
https://demo.lizmap.com/lizmap/index.php/view/map?repository=features&project=cats
- the "permalink" button is hidden by default : CF Javascript : https://github.com/3liz/lizmap-web-client-demo/blob/14c01fcc76c4e25cbcf96b50ecd96e3cb45e396b/projects/cats/media/js/cats/panels.js#L5
By adding no_user_defined_js=1 in the URL, the button is here, which shows that link before works (hiding the button).
https://demo.lizmap.com/lizmap/index.php/view/map?repository=features&project=cats&no_user_defined_js=1
If you clear the cache of the "features" directory that contains your "cats" map via the Lizmap admin and reload the map in Chrome, the bug doesn't occur either? On my side it's systematic, after doing that all the custom javascripts don't load correctly. But it may be a bad setting on our part...
If you clear the cache of the "features" directory that contains your "cats" map via the Lizmap admin and reload the map in Chrome, the bug doesn't occur either? On my side it's systematic, after doing that all the custom javascripts don't load correctly. But it may be a bad setting on our part...
I have the same issue. If browser cache is cleared then custom javascript are not loaded correctly first time. I have to refresh the web page, then the scripts are loaded correctly.
If you clear the cache of the "features" directory that contains your "cats" map via the Lizmap admin and reload the map in Chrome, the bug doesn't occur either?
This cache is about tiles, it's not related to this kind of cache. But indeed, this button is missing a tooltip to explain its purpose.
@ygorigor Can you check in your webbrowser tools, about HTTP requests tab if the _r changes in the URL when you reload the map ? (look at https://demo.lizmap.com/lizmap/index.php/view/map?repository=features&project=cats for instance to compare) (@Mavialle Your issue in the other ticket was here, the number change always, meaning that no files could be saved on the server side)
it looks like Javascript executed too early to hide your buttons ?
You can try on demo, buttons are hidden, right @Mavialle @ygorigor ?
If you clear the cache of the "features" directory that contains your "cats" map via the Lizmap admin and reload the map in Chrome, the bug doesn't occur either?
This cache is about tiles, it's not related to this kind of cache. But indeed, this button is missing a tooltip to explain its purpose.
@ygorigor Can you check in your webbrowser tools, about HTTP requests tab if the
_rchanges in the URL when you reload the map ? (look at https://demo.lizmap.com/lizmap/index.php/view/map?repository=features&project=cats for instance to compare) (@Mavialle Your issue in the other ticket was here, the number change always, meaning that no files could be saved on the server side) it looks like Javascript executed too early to hide your buttons ?You can try on demo, buttons are hidden, right @Mavialle @ygorigor ?
Look at this example
Look at this example
yes, I got your problem ;-) but please answer my questions. As I do not replicate https://demo.lizmap.com/lizmap/index.php/view/map?repository=features&project=cats we can't help you more
Look at this example
yes, I got your problem ;-) but please answer my questions. As I do not replicate https://demo.lizmap.com/lizmap/index.php/view/map?repository=features&project=cats we can't help you more
I hope this can help
This issue is somehow related to Chrome browser. I tried now to clear cache in Firefox and reload the web page, scripts are loaded correctly.
This cache is about tiles, it's not related to this kind of cache. But indeed, this button is missing a tooltip to explain its purpose.
Ok, sorry
@Mavialle Your issue in the other ticket was here, the number change always, meaning that no files could be saved on the server side)
Sorry, this issue is still not resolved. Could you just confirm that you are talking about the revision number? And could you take a screenshot to show me where to see this number?
it looks like Javascript executed too early to hide your buttons ?
That's exactly it, because javascripts are taken into account after the page refreshes
You can try on demo, buttons are hidden, right @Mavialle @ygorigor ?
I confirm: no bugs on https://demo.lizmap.com/lizmap/index.php/view/map?repository=features&project=cats with Chrome, the javascripts still work, even after the cache has been cleared.
Do you think this could be related to the temporary directory issue that we still haven't resolved ?
Hello,
I have exactly the same problem, for example on this interface where custom javascripts seem to launch randomly after refreshing the page. I have the impression that the bug only occurs on Chrome, but not on Firefox. @NvBgm, is it the same for you? Does it bug on Firefox?
Versions :
- Lizmap Web Client : 3.8.6 - commit 50eef0f 50eef0fa5
- Lizmap plugin : 4.4.7
- QGIS Desktop : 3.34.15
- QGIS Server : 3.40.4
- Py-QGIS-Server or QJazz : not used
- QGIS Server plugin atlasprint : 3.4.1
- QGIS Server plugin cadastre : 2.0.1
- QGIS Server plugin lizmap_server : 2.12.0
- QGIS Server plugin wfsOutputExtension : 1.8.2
List of Lizmap Web Client modules : List of safeguards :
On firefox the same.
@ygorigor Can you check in your webbrowser tools, about HTTP requests tab if the
_rchanges in the URL when you reload the map ? (look at https://demo.lizmap.com/lizmap/index.php/view/map?repository=features&project=cats for instance to compare)
Regarding this, @ygorigor and @NvBgm : if you go to https://demo.lizmap.com/lizmap/index.php/view/map?repository=features&project=cats and open the developer tools, then go to "Sources" and open top > demo.lizmap.com > lizmap > assets, you can see a revision number written "_r= somenumber" as in the image above. This number never changes, even after a page reload. However, if you go to https://carto-dev.tigeo.fr/index.php/view/map?repository=public&project=Adressage_Denat and do the same, the revision number changes after each page reload. On your Lizmap instance, how does your revision number behave?
@Gustry, can you confirm my explanation? In any case, the upgrade to Lizmap 3.8.8 does not correct the bug.
Yes @Mavialle I confirm your explanations, thanks.
Today, (until the upgrade of our Lizmap Web Client version on demo.lizmap.com), you and I should have the revision number 250507143037 because JS files were generated only once)
If i go to https://demo.lizmap.com/lizmap/index.php/view/map?repository=features&project=cats the revison code do not change afther reloading the page. If i go to https://carto-dev.tigeo.fr/index.php/view/map?repository=public&project=Adressage_Denat the revision code change every time i do a reload on the page. If i go to my page also every time i reload the page, the revison code change
I guess you mean tigeo.fr in your second link @NvBgm ? Please edit if so.
@Gustry If the bug really comes from there, how do you think we can fix it ? In ticket #5452, you told me that it must come from a problem with the temporary folder of my installation, but which temporary folder exactly are you talking about? Knowing that our installation was done by docker, and that the bug did not occur on version 3.7 while the revision number changed (see here for example, with Lizmap 3.7.5 : https://carto.tigeo.fr/index.php/view/map?repository=public&project=Adressage_Fraisse_sur_Agout).
I see in the lizmap-web-client/lizmap/app/system/mainconfig.ini.php file that there is an "assetsRevision" parameter. "If empty, no revision will be added. If "autoconfig", the revision number will be generated automatically each time". Could this have something to do with the behavior of our instances?
@Gustry If the bug really comes from there, how do you think we can fix it ? In ticket https://github.com/3liz/lizmap-web-client/issues/5452, you told me that it must come from a problem with the temporary folder of my installation, but which temporary folder exactly are you talking about?
Sorry, I don't know either for now.
Ok, could you just tell me what "assetsRevision" setting you have in your mainconfig.ini.php file at https://demo.lizmap.com/lizmap/index.php/view/map?repository=features&project=cats ?
Otherwise, I kept searching and I noticed that the custom js, put in the media > js folder of the map directory only launches if the download of the contents of "lizmap.js" finishes after the custom js (see first two images below). But there must be another problem in the order of launching the js, because sometimes the fact that the lizmap.js finishes after is not enough (see images 3 and 4). And on https://demo.lizmap.com/lizmap/index.php/view/map?repository=features&project=cats , this order seems to have no importance.
I also notice, on https://demo.lizmap.com/lizmap/index.php/view/map?repository=features&project=cats, there's a lot more JS that launches when the interface starts but, unless I'm mistaken, there's no map-project.js like in https://carto-dev.tigeo.fr/index.php/view/map?repository=public&project=Adressage_Denat. Is this normal?
Finally, on Lizmap 3.7, it seems that custom js are queued until the majority of js are launched, whereas on 3.8 the waiting time is the same for all js, see the last two images..
I don't know if any of this matters, and I'm sorry if it doesn't.
Because the same interface works without problems on lizmap 3.7 and with the bug on 3.8, I imagine that it is the change of behavior described last in my previous post which creates the problem, don't you think? Is it possible to put this behavior back on version 3.8 ?
Hello,
The bug persists on version 3.9.0. @Gustry did you see my last message? What do you think ?
Also here version 3.9.0 the same.
Hello,
Some new elements :
I - I was finally able to access the lizmap-web-client/lizmap/app/system/mainconfig.ini.php file, and "assetsRevision" parameter was indeed on "autoconfig". So I set it to empty, as indicated in the documentation. Now my revision numbers are fixed, but the bug persists so that wasn't the problem. https://carto-dev.tigeo.fr/index.php/view/map?repository=public&project=Adressage_Denat
II - I logged the uicreated event, which is supposed to launch my js. For example:
lizMap.events.on({ 'uicreated':function(evt){ console.log("UI prête, masquage du bouton metadata"); $('#button-metadata').hide(); } })
I then realized that when js did not work, it was because the event uicreated was never triggered. Maybe because the js are launched too later and the event already taken place ? Whereas on Lizmap 3.7, as the custom js were launched differently, it did not cause problems ?
III - If I have never managed to reproduce the problem on https://demo.lizmap.com/lizmap/index.php/view/map?repository=features&project=cats, it sometimes happens on https://demo.lizmap.com/lizmap/index.php/view/map?repository=features&project=land_use (e.g.: permalink button not hidden)
Given all this, I have the impression that the problem is due to the execution order of the js, which has changed since version 3.8, and which in one way or another prevents listening to Lizmap-specific events like uicreated (but I did it with other Lizmap events and it also bugged). What do you think ? Do you know how events like uicreated are handled ? Can they trigger events indefinitely or are they destroyed after a certain time ?