Skip to content

Commit

Permalink
docs(changeset): gatsby-source-greenhouse-jobboard: touch all cached …
Browse files Browse the repository at this point in the history
…nodes
  • Loading branch information
cometkim committed Feb 22, 2023
1 parent ba52112 commit e0dd41e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/slow-walls-give.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@karrotmarket/gatsby-source-greenhouse-jobboard": patch
---

gatsby-source-greenhouse-jobboard: touch all cached nodes
Original file line number Diff line number Diff line change
Expand Up @@ -428,16 +428,20 @@ export const sourceNodes: GatsbyNode['sourceNodes'] = async ({
actions.createNode(node);
}

if (forceGC) {
const shouldLeave = new Set<string>(jobNodes.map(node => node.id));
const cachedNodes = [
...getNodesByType('GreenhouseJobBoardJob'),
...getNodesByType('GreenhouseJobBoardDepartment'),
];
for (const node of cachedNodes) {
if (node.boardToken !== boardToken) {
continue;
}
const shouldLeave = new Set<string>(jobNodes.map(node => node.id));
const cachedNodes = [
...getNodesByType('GreenhouseJobBoardJob'),
...getNodesByType('GreenhouseJobBoardDepartment'),
];

for (const node of cachedNodes) {
if (node.boardToken !== boardToken) {
continue;
}

actions.touchNode(node);

if (forceGC) {
if (!shouldLeave.has(node.id)) {
actions.deleteNode(node);
}
Expand Down

0 comments on commit e0dd41e

Please sign in to comment.