Skip to content

Commit

Permalink
Merge pull request #9 from mathieuforest/patch-1
Browse files Browse the repository at this point in the history
prevent node to be put in garbage when built from cache

Closes #6
  • Loading branch information
andrew-codes authored Mar 27, 2018
2 parents a60608d + 0908cd7 commit cfcff48
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,17 @@ const SearchIndex = new GraphQLScalarType({
},
});

exports.sourceNodes = async ({ getNodes, boundActionCreators }) => {
const {
touchNode,
} = boundActionCreators;

const existingNodes = getNodes().filter(
n => n.internal.owner === `@andrew-codes/gatsby-plugin-elasticlunr-search`
);
existingNodes.forEach(n => touchNode(n.id));
};

exports.onCreateNode = ({node, boundActionCreators, getNode}, {
resolvers,
}) => {
Expand Down

0 comments on commit cfcff48

Please sign in to comment.