-
Notifications
You must be signed in to change notification settings - Fork 10.3k
docs(gatsby-source-filesystem): add warning about parentNodeId
for util functions like createFileNodeFromBuffer
#34313
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -237,6 +237,12 @@ module.exports = function createRemoteFileNode({ | |
) | ||
} | ||
|
||
if (parentNodeId === null) { | ||
console.warn( | ||
`It seems that you forgot to pass in 'parentNodeId' for a file you try to create with 'createRemoteFileNode'. Not doing this is causing problems as a) when the server is restarted, if the parent of the created file node is loaded from the cache, the linked file node won't be recreated which means it will be garbage collected and b) if a parent node is deleted, the linked File node won't also be deleted.` | ||
) | ||
} | ||
|
||
Comment on lines
+240
to
+245
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as in
|
||
// Check if we already requested node for this remote file | ||
// and return stored promise if we did. | ||
if (processingCache[url]) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I would like to enforce this and throw an error, but I don't dare to suggest such a potential breaking chance. Does one of the maintainers has an opinion on that? Do we have use cases where
parentNodeId
is indeed allowed to be null?