forked from gatsbyjs/gatsby
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add warning when node-creating plugins create no nodes (gatsbyjs#2588)
* Add warning when node-creating plugins create no nodes The warning serves two purposes: a) to notify those that are using the plugin that it hasn't created any nodes and can likely be removed, and b) to reduce the confusion caused by a GraphQL query for a specific node erroring as no nodes have been created yet. See gatsbyjs#2212 for more. As part of this work, two key changes have been made to the redux store: a) Each plugin now has a `nodeAPIs` key whose value retains an array of strings denoting the names of which Gatsby APIs the plugin implements. b) At the root of the store, a new key exists named `apiToPlugins` has been created which stores a simple key -> val map from the name of a Gatsby API, to an array containing the string names of all plugins which implement that API. a) is helpful when needing to know what APIs a given plugin implements and b) is helpful when code requires a quick look up of which plugins implement a specific API - we pay the cost once at creation time rather than iterating through the plugin objects whenever we need to know. * Trigger builds
- Loading branch information
1 parent
6be3e26
commit 64ae90f
Showing
5 changed files
with
106 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = (state = [], action) => { | ||
switch (action.type) { | ||
case `SET_SITE_API_TO_PLUGINS`: | ||
return { ...action.payload } | ||
default: | ||
return state | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters