Skip to content

Commit cfcff48

Browse files
authored
Merge pull request #9 from mathieuforest/patch-1
prevent node to be put in garbage when built from cache Closes #6
2 parents a60608d + 0908cd7 commit cfcff48

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/gatsby-node.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,17 @@ const SearchIndex = new GraphQLScalarType({
8585
},
8686
});
8787

88+
exports.sourceNodes = async ({ getNodes, boundActionCreators }) => {
89+
const {
90+
touchNode,
91+
} = boundActionCreators;
92+
93+
const existingNodes = getNodes().filter(
94+
n => n.internal.owner === `@andrew-codes/gatsby-plugin-elasticlunr-search`
95+
);
96+
existingNodes.forEach(n => touchNode(n.id));
97+
};
98+
8899
exports.onCreateNode = ({node, boundActionCreators, getNode}, {
89100
resolvers,
90101
}) => {

0 commit comments

Comments
 (0)