Page MenuHomePhabricator

Don't add geojson to livedata for wikis with snapshot on
Open, MediumPublic

Description

If the wiki has wgKartographerStaticMapframe=true, we shouldn't add data to wgKartographerLiveData. Instead the data should be downloaded on the fly when the user clicks on it.

We also need to test what happens if a wiki that was NOT static, becomes static, and the reverse. The map should work without null-save.

Event Timeline

debt subscribed.

Moving off the sprint board - the Discovery team won't be able to finish this work at this time.

CC @Krinkle
Just to be clear about the performance implications, we're sending the GeoJSON "live data" in the article <head>, which is as expensive as it gets. This data is unused in the case of high-traffic wikis with $wgKartographerStaticMapframe = true.

To take a random example, https://en.wikipedia.org/wiki/U.S._Route_14_in_Wyoming is delivering 105kB of polygon lines in the head.

When we fix this, there will need to be a new mechanism where the dynamic map code loads mapdata on-demand from its API. Let's remember to include a revid parameter to enable all the fun use cases.

Change 736313 had a related patch set uploaded (by TheDJ; author: TheDJ):

[mediawiki/extensions/Kartographer@master] Don't add geojson livedata on wikis with staticmaps

https://gerrit.wikimedia.org/r/736313

While working on T293841 I realized this change will break page histories on wikis with dynamic maps enabled. When I jump back to an old revision where a map was different, two things happen:

  1. A static map image is requested, but the mapdata API request can't find that map in the most recent revision. Kartotherian will render an empty map with no geometry or markers.
  2. The dynamic JavaScript will kick in and … run into the same problem. When the GeoJSON is not part of the page's header any more it needs to be requested via the mapdata API. But this doesn't work for old revisions where the map was different.

This might be fixed with what we plan to do with revids. I suggest to not merge this to soon. As far as I understand there should be no pressure to do this. It was like this for a long time. It shouldn't matter that much if we leave it like it is for some more weeks.