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

feat(gatsby): detect node mutations (enabled by flag or env var) #34006

Merged
merged 12 commits into from Dec 8, 2021

Conversation

pieh
Copy link
Contributor

@pieh pieh commented Nov 17, 2021

Description

This adds a mode that allows detecting where nodes are being mutated directly which just doesn't work (as it used to) when LMDB is used.

This is done by wrapping nodes with recursive Proxies when being passed to plugins/user code and logging whenever set handler is called (with some exception as gatsby internals DO mutate nodes, but later they do use actions to actually update those nodes in LMDB, so those mutations are not lost)

Unfortunately we can't just have it always enabled as there is performance impact. From my testing it was mostly impacting node creation (the onCreateNode patterns unfortunately need this up front instead of "on usage" with getNode helpers or via nodeModel methods)

Documentation

  • TODO: add how-to guide about this

Added guide:

localhost_8000_docs_how-to_local-development_debugging-missing-data_

Related Issues

[sc-40551]

codex088
codex088 previously approved these changes Nov 23, 2021
@pieh pieh force-pushed the node-mutations-are-a-no-no branch from 48ae849 to 1fa9186 Compare December 7, 2021 11:10
@pieh pieh marked this pull request as ready for review December 7, 2021 11:10
@pieh pieh merged commit d8aec30 into master Dec 8, 2021
@pieh pieh deleted the node-mutations-are-a-no-no branch December 8, 2021 16:28
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.

None yet

3 participants