Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion crates/next-api/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,12 @@ impl Project {
// INVALIDATION: This is intentionally untracked to avoid invalidating this
// function completely. We want to initialize the VersionState with the
// first seen version of the session.
VersionState::new(version.into_trait_ref_untracked().await?).await
VersionState::new(
version
.into_trait_ref_strongly_consistent_untracked()
.await?,
)
.await
}

/// Emits opaque HMR events whenever a change is detected in the chunk group
Expand Down
28 changes: 18 additions & 10 deletions crates/next-api/src/versioned_content_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,25 @@ impl VersionedContentMap {
client_output_path: Vc<FileSystemPath>,
) -> Result<Vc<OptionMapEntry>> {
let assets = *assets_operation.await?;
let entries: Vec<_> = assets
.await?
.iter()
.map(|&asset| async move { Ok((asset.ident().path().resolve().await?, asset, assets)) })
.try_join()
.await?;

async fn get_entries(
assets: Vc<OutputAssets>,
) -> Result<Vec<(Vc<FileSystemPath>, Vc<Box<dyn OutputAsset>>)>> {
let assets_ref = assets.await?;
let entries = assets_ref
.iter()
.map(|&asset| async move {
let path = asset.ident().path().resolve().await?;
Ok((path, asset))
})
.try_join()
.await?;
Ok(entries)
}
let entries = get_entries(assets).await.unwrap_or_default();
self.await?.map_path_to_op.update_conditionally(|map| {
let mut changed = false;
for &(k, _, v) in entries.iter() {
if map.insert(k, v) != Some(v) {
for &(k, _) in entries.iter() {
if map.insert(k, assets) != Some(assets) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is to see if a value was different from assets?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If so, don't we need calling resolve()?

changed = true;
}
}
Expand All @@ -116,7 +124,7 @@ impl VersionedContentMap {
let map_entry = Vc::cell(Some(MapEntry {
assets_operation: assets,
side_effects,
path_to_asset: entries.into_iter().map(|(k, v, _)| (k, v)).collect(),
path_to_asset: entries.into_iter().collect(),
}));
Ok(map_entry)
}
Expand Down