Skip to content

Commit

Permalink
fix(turbopack): deal with eventual consistency in get_directory_tree (v…
Browse files Browse the repository at this point in the history
…ercel#62444)

### What?

The file watcher might invalidate the (moved / deleted) directory before
the parent task can mark it as no longer needed.

Closes PACK-2588
  • Loading branch information
ForsakenHarmony authored Feb 23, 2024
1 parent 01c1bfa commit dcf8f04
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/next-swc/crates/next-core/src/app_structure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,14 @@ async fn get_directory_tree_internal(
page_extensions: Vc<Vec<String>>,
) -> Result<Vc<DirectoryTree>> {
let DirectoryContent::Entries(entries) = &*dir.read_dir().await? else {
bail!("{} must be a directory", dir.to_string().await?);
// the file watcher might invalidate things in the wrong order,
// and we have to account for the eventual consistency of turbo-tasks
// so we just return an empty tree here.
return Ok(DirectoryTree {
subdirectories: Default::default(),
components: Components::default().cell(),
}
.cell());
};
let page_extensions_value = page_extensions.await?;

Expand Down

0 comments on commit dcf8f04

Please sign in to comment.