Skip to content

Commit

Permalink
Fix bug with cache and glob entries (#9264)
Browse files Browse the repository at this point in the history
This fixes #8477.

I wasn't able to get a reliable repro in a test for this, but I have
previously manually applied this patch in a large codebase where we saw
this issue and it resolved it.

Co-authored-by: mattcompiles <mattjones701@gmail.com>
  • Loading branch information
marcins and mattcompiles authored Oct 3, 2023
1 parent 356be96 commit f744d1b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/core/core/src/RequestTracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -764,15 +764,19 @@ export class RequestGraph extends ContentGraph<
let fileNameNodeId = this.getNodeIdByContentKey(
'file_name:' + basename,
);

// Find potential file nodes to be invalidated if this file name pattern matches
let above = this.getNodeIdsConnectedTo(
let above: Array<FileNode> = [];
for (const nodeId of this.getNodeIdsConnectedTo(
fileNameNodeId,
requestGraphEdgeTypes.invalidated_by_create_above,
).map(nodeId => {
)) {
let node = nullthrows(this.getNode(nodeId));
invariant(node.type === 'file');
return node;
});
// these might also be `glob` nodes which get handled below, we only care about files here.
if (node.type === 'file') {
above.push(node);
}
}

if (above.length > 0) {
didInvalidate = true;
Expand Down

0 comments on commit f744d1b

Please sign in to comment.