Hi there,
I am currently trying to figure out the Netlify API. However since there are no descriptions to the function names in the API doc, I need to ask some stupid questions here, sorry.
I have an App where users can create lists of entries. Those lists are data driven and read more often then written.
At the moment those lists get rendered at build time with Eleventy and a database lookup, as well as through a lambda function redirect if the rendered page doesn’t exist.
This works like a charm for newly created lists. Until the next build run, a lamba ‘serverside renders’ my pages and when the build run comes along, those sites are now static content. Wohoo! JAMStack ftw.
Now I am trying to solve the case where the author of a list performs an update to an already existing list. Although It is not time critical, I want to ‘eventually’ have the new updated version be static content as well, so I am trying to do this via the Netlify deply API.
My first idea was to simply remove or invalidate the cache on the specific site. This way the redirect for new sites would grap again and the next build would render der the updated version of the page.
This however seems to not be supported by Netlifys atomic deploy design.
Here is my current Idea
…do please tell me if this is feasable, not a good idea or completely bonkers.
When a list gets updated, a lambda function tells Netlify to
listSiteDeploys
-
getDeploy
on the latest deploy -
createSiteDeploy
with a copy of the previously gotten deploy, but with the updated file missing
And somehow I gues there could be a race condition if two of those functions run at the same time for different pages, but I did not find any mechanic to prvide locks on the deploy mechanic as a whole or to atomically sent an updated deploy for the currently active deploy.
Brainstormyness
Is that a feassable approach that just needs some tweeking or is it abnsolutely convoluted (seems a bit like that) ?
Are build hooks maybe something that could help me here?
Any other solutions to the same kind of problems that I should be aware of?
Any feedback is greatly appreciated.