geoadmin / mf-geoadmin3

Legacy source code of map.geo.admin.ch
https://map.geo.admin.ch
Other
227 stars 72 forks source link

AppCache is deprecated and create unwanted side effects #5096

Closed davidoesch closed 4 years ago

davidoesch commented 4 years ago

open on IPHOne 7 latest safari https://s.geo.admin.ch/8643b05c8a

opens only station but not the areas

expected result

image

Edit pakb:

This is a side effect of having an appcache file, which is a deprecated way of telling browsers which file are part of an "app". It should be supplanted by Service Worker (https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers)

davidoesch commented 4 years ago

Try to create a tweet [DE] Neu: Karte mit theoretischer #5G -Abdeckung im Aussenbereich (Planquadrate 100x100 Meter) https://map.geo.admin.ch/?layers=ch.bakom.mobilnetz-5g&lang=de&topic=ech&bgLayer=ch.swisstopo.pixelkarte-farbe&E=2602770.00&N=1198030.00&zoom=6&layers_opacity=0.75 des @bakomCH cc Anbieter @SaltMobile_DE

@Sunrise_de

@Swisscom_de

iot #technology #network #Schweiz

Result map is empty

AFoletti commented 4 years ago

Using chrome on the same hardware I'm not even getting the layer as a result of a search. On Firefox (still iPhone7) however it works (both in the search AND in the visualuzation)

ltclm commented 4 years ago

@pakb debugging the issue on my samsung S9 / chrome showed the following error:

build.js:84790 Uncaught TypeError: Cannot read property 'timeEnabled' of undefined
    at Object.getLayerTimestampFromYear (build.js:84790)
    at Object.getOlLayerById (build.js:84783)
    at Object.addBodLayer (build.js:84918)
    at m.a.preview (build.js:85315)
    at HTMLDivElement.<anonymous> (build.js:85323)
    at HTMLDivElement.dispatch (build.js:60)
    at HTMLDivElement.y.handle (build.js:60)

not sure if that helps you.

ltclm commented 4 years ago

theres some appcache magic redirecting to:

Adding master entry to Application Cache with manifest https://map.geo.admin.ch/geoadmin.b8c60f5.appcache

CACHE MANIFEST
# Version b8c60f5

CACHE:
/master/1912040901/b8c60f5/lib/build.js
/master/1912040901/b8c60f5/style/app.css
/master/1912040901/b8c60f5/style/font-awesome-4.5.0/font/fontawesome-webfont.woff
/configs/services.json
/configs/de/layersConfig.json
/master/1912040901/b8c60f5/locales/de.json
/configs/fr/layersConfig.json
/master/1912040901/b8c60f5/locales/fr.json
/configs/it/layersConfig.json
/master/1912040901/b8c60f5/locales/it.json
/configs/en/layersConfig.json
/master/1912040901/b8c60f5/locales/en.json
/configs/rm/layersConfig.json
/master/1912040901/b8c60f5/locales/rm.json
/master/1912040901/b8c60f5/img/geolocation_heading_marker.png

NETWORK:
#use by CatalogServer, checker, tiles
*
checker #we need to specify the checker here to avoid the appcache callback to be apply

FALLBACK:

# With Permalink
/? index.html
index.html? index.html
mobile.html? mobile.html

# Without permalink
/ index.html
pakb commented 4 years ago

image IMO it's related to layersConfig.json being cached by CloudFront and serving the one from before the last deploy. I've created a cache invalidation request, I'm waiting for it to complete and I'll check again

pakb commented 4 years ago

I don't understand why, but Safari on iOs keep serving me the old version of the layersConfig.json (even if I access it directly) but then serves me the correct one if I open https://map.geo.admin.ch/?mobile=false At least it is clear that this is related to some cache issue

pakb commented 4 years ago

So by deleting anything related to admin.ch in my iOs cache, it works! So it's a problem on devices, because we haven't deployed geoadmin code yesterday (only LayersConfig). We will have to find a way to make this work (we don't want to have to deploy code in order for a data deploy to work properly). In the meantime, I'll make a blank deploy just to update the app cache file, so that phones know that there's new stuff and they should delete current cache...

pakb commented 4 years ago

quote from Mozzila's website

The previous attempt — AppCache — seemed to be a good idea because it allowed you to specify assets to cache really easily. However, it made many assumptions about what you were trying to do and then broke horribly when your app didn’t follow those assumptions exactly. Read Jake Archibald's (unfortunately-titled but well-written) Application Cache is a Douchebag for more details

Well that sounds like now...

pakb commented 4 years ago

This is now described as an Epic in Jira. I'll close this issue. While waiting for this to be done, we will have to deploy geoadmin whether there's new stuff or not, so that the AppCache file is modified and mobile devices pick up the new layersConfig. I'll update the deploy doc accordingly.

davidoesch commented 4 years ago

This @pakb is the main issue we have with RE3 . We always needed a code deploy for the data deploy. Separation was what we wanted to achieve with RE4

so - we have to live with that until we have a next generation Viewer

gberaudo commented 4 years ago

@pakb, you certainly already knows about it, AppCache will soon disappear from Firefox: https://www.fxsitecompat.dev/en-CA/docs/2019/application-cache-storage-has-been-removed-in-nightly-and-early-beta/