-
Notifications
You must be signed in to change notification settings - Fork 3
Description
- Run the app locally after fresh reboot, visit /v1/base/style.json. You'll notice it's the exact file in /data/base/style.json.
- Visit /v1/layer-groups. Then go back and reload /v1/base/style.json. Notice it's identical to /v1/layer-groups.
This is because of a memory leak located here:

This utility imports a "json" file then mutates it. Because the file extension is json, it suggests that it's static and immutable, but it's not — I think it's simply loaded into memory when the app boots and preserves whatever mutations were made the last time the route was loaded. That means /v1/base/style.json will return whatever tiles were generated for which app was last visited. In theory, you could be getting ZoLa style.json when you wanted FactFinder style.json. Spooky!
A quick fix would be create a local copy of style.json in consuming apps. Another approach might be to make a deep copy of style.json in this app. A third might be to look at how it loads static JSON elsewhere in the app using utils/local-resources-utilities/-load-json.js.