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

refactor(gatsby): simplified materialization a bit #31882

Merged
merged 7 commits into from
Jun 30, 2021

Conversation

vladar
Copy link
Contributor

@vladar vladar commented Jun 12, 2021

Description

Change 1

Materialization is specific to node types but not to interface types. So in the case of interface types, we should run multiple passes on each node type separately.

And since we cache results by type - we are running materialization multiple times for the same type when site has mixed graphql queries (some on interface type, others - on specific node types)

Change 2

Use WeakSet for trackedRootNodes vs Set for correctness: we use WeakMap for rootNodeMap but if the node is garbage-collected from this map, its id still stays in trackedRootNodes which is wrong. After this change, if it is garbage-collected, both maps will reflect a consistent state of the world.

This was not a big deal before (because nodes were never actually garbage-collected but will be a problem with lmdb)

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jun 12, 2021
@vladar vladar removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jun 12, 2021
@vladar vladar marked this pull request as draft June 20, 2021 17:14
@vladar vladar changed the title refactor(gatsby): prepare node-model for lazy node fetching refactor(gatsby): simplified materialization a bit Jun 29, 2021
@vladar vladar marked this pull request as ready for review June 29, 2021 21:39
@pieh pieh self-assigned this Jun 30, 2021
Copy link
Contributor

@pieh pieh left a comment

Choose a reason for hiding this comment

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

LGTM

@vladar vladar added the bot: merge on green Gatsbot will merge these PRs automatically when all tests passes label Jun 30, 2021
@gatsbybot gatsbybot merged commit 4320072 into master Jun 30, 2021
@gatsbybot gatsbybot deleted the vladar/node-model-tweaks branch June 30, 2021 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: merge on green Gatsbot will merge these PRs automatically when all tests passes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants