Closed kszot-ref closed 3 years ago
We've went through the code with Kyle, so I've got a few tips where to look to debug this issue. During the call we didn't pinpoint it, but I've tried again the next day.
I've went through the node creation process with a debugger and came to a conclusion that this is indeed an issue inside the gatsby-source-drupal plugin.
To create a backlink for a referenced node, the plugin does the following steps:
When the code reaches this point, it gets the node from the datastore, but the issue is that data was modified inplace, the updated values are already in there. So it actually compares the new contentDigest with the already updated contentDigest, which means that the code thinks that the node didn't update at all, as in this scenario they will always be the same.
Preliminary Checks
Description
Example scenario:
The end result is that page-data.json for that page (office) has stale data, so it's not rebuilt properly.
In our use case the backlinks are used to display a list of vacancies on an office page, and although the backlink is created fine in the plugin, that's not enough to rebuild the page, so altough the graphql data is updated properly, the page uses old data.
I was able to check the node before it was passed on to the "createNode" function with a debugger. Everything seemed fine there. But even manually changing the value of one of the fields (before the contentDigest is genererated) didn't cause page query reruns. I suspect this might be an issue that instead of creating a new object with copied data, the plugin is modifying an object that it got through the "getNode" function. After this I've updated this "node--office" in drupal (didn't change any data, just saved it), and the next build picked that up properly and rerun the queries - the data didn't change, but the "createNode" method got a different object with the same fields which was enough to cause an update.
Reproduction Link
-
Expected Result
Office queries would be rerun.
Actual Result
Office queries aren't rerun.
Environment
Config Flags
No response