Description
When removing a piece of content from Umbraco and rebuilding the Gatsby frontend the piece of content is still available and outputted onto the site. The content node shouldn't be available since it's deleted in Umbraco.
This also happens when using the __refresh
endpoint to refresh the data. Which is expected since it's the same code.
Note that when creating/updating a node in Umbraco and rebuilding, the changes are reflected correctly.
To reproduce
- Build the site as normal. (I've tested with
gatsby develop
) - Remove a content node from Umbraco.
- Rebuild the site as normal. (e.g. stop and restart
gatsby develop
) - Notice that the content node still exists in Gatsby. (e.g. by querying for it in the GraphiQL interface.)
👨⚕️ Diagnosis
It seems that this is related to Gatsby's build-caching mechanism, which automatically caches all nodes created by a plugin.
When you clean the cache before rebuilding the deleted node no longer shows up in the final site, this confirms the fact that this is related to Gatsby's build-caching.
🛠 Workaround
A simple workaround is to clear Gatsby's cache. The simplest way to do that is by using the gatsby clean
command. (Also available at npm run clean
, in our repository.)