Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gatsby references #1431

Merged
merged 4 commits into from
Oct 10, 2023
Merged

Gatsby references #1431

merged 4 commits into from
Oct 10, 2023

Conversation

Leksat
Copy link
Member

@Leksat Leksat commented Oct 10, 2023

Package(s) involved

amazeelabs/silverback_gatsby

Description of changes

Whenever we track an update on an entity, get all its usages and track the source entities as well.

Motivation and context

gatsby-graphql-toolkit creates node references in Gatsby data layer. Yet it does not clean them up when a target node is removed.

    if (node) {
      context.gatsbyApi.actions.deleteNode(node)
    }
    // TODO: find all nodes referencing deleted nodes and update/refetch all of them?

https://github.com/gatsbyjs/gatsby-graphql-toolkit/blob/cec93fe2457aa0de64dbdeb759626010d9fe270a/src/source-nodes/node-actions/delete-nodes.ts#L17-L20

Related Issue(s)

#1274

How has this been tested?

Manually. Added an integration test case.

await resetState();
});

test('@gatsby-build references', async ({ page }) => {
Copy link
Member Author

@Leksat Leksat Oct 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should have fallen on the test commit, yet it did not. I don't know why.

Locally it fails properly. But in CI an incremental Gatsby build sources all nodes for some reason.

Another evidence that we need to get rid of @amazeelabs/silverback-playwright ASAP. Will do in a separate PR.

@Leksat Leksat marked this pull request as ready for review October 10, 2023 15:42
@Leksat Leksat requested a review from pmelab October 10, 2023 15:56
This is needed for the future entity_usage integration. We will need to act before entity_usage
updates its tracking data.
Copy link
Contributor

@pmelab pmelab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So its not going to recursively update chains, right? Just the direct parent level. Should be good enough for the Gutenberg use case.

@Leksat Leksat merged commit c53ca99 into development Oct 10, 2023
3 checks passed
@Leksat Leksat deleted the gatsby-references branch October 10, 2023 22:08
@Leksat
Copy link
Member Author

Leksat commented Oct 10, 2023

Yes, just direct parents.

Still I'm a little concerned about the performance. What if we get an entity used in 1k other entities 🙈 Time will tell 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants