Skip to content

Commit

Permalink
fix(NextjsCacheLayer): fix missing invalidations when creating relati…
Browse files Browse the repository at this point in the history
…onships
  • Loading branch information
irishcarbomb777 committed May 6, 2024
1 parent b027454 commit a01f7ea
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/layers/NextjsCache/defineNextjsCacheLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export const defineNextjsCacheLayer = <
// Invalidate all caches for the node, remember react will have run through the tree and tried all of the getNodes which returned null.
invalidateCacheKeys(node)
revalidateTag(`getNodeType-${node.nodeType}`)
revalidateTag(`getRelatedTo-${node.nodeType}`)
// Return the nodekey
return Ok(node)
},
Expand Down Expand Up @@ -131,6 +132,8 @@ export const defineNextjsCacheLayer = <
// Invalidate all caches for the fromNode and toNode
const cacheKey = `getRelatedTo-${fromNode.nodeId}-${relationshipType}-${toNode.nodeType}`
revalidateTag(cacheKey)
revalidateTag(`getNodeType-${toNode.nodeType}`)
revalidateTag(`getRelatedTo-${toNode.nodeType}`)
return Ok(createRelationshipResult.val)
},
}
Expand Down

0 comments on commit a01f7ea

Please sign in to comment.