guardian/frontend — pull request #4834 by robertberry (2014-06-23 16:50:15+00:00)
Title: Update Facia Tool config editor to use partial updates

Changes the config editor part of Facia tool.

Previously Facia Tool kept the entire config in memory in the browser and then with each update, pushed the whole config back to the server side, which then overwrote whatever was in S3. This caused issues when more than one editor was attempting to simultaneously update the config, as updates would stomp each other.

This is a partial solution to the problem. Now the JavaScript pushes partial updates (i.e., create this collection, update this collection, create this front, update this front), which then trigger server side to load the current config from S3, perform the update, then write it back. Although this is still not perfect (as there's a race condition in that time between loading, updating, and writing back), it should be a much better experience overall. In the future we should look at splitting the config up further in terms of how we actually store the data.

My JavaScript is extremely rusty so all suggestions very welcome!