Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turbopack: avoid sending serverComponentChanges with errors #57425

Merged
merged 1 commit into from
Oct 25, 2023
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
13 changes: 7 additions & 6 deletions packages/next-swc/crates/napi/src/next_api/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,17 @@ pub fn endpoint_server_changed_subscribe(
func,
move || async move {
let changed = endpoint.server_changed();
// We don't capture issues and diagonistics here since we don't want to be
// notified when they change
changed.strongly_consistent().await?;
Ok(())
let issues = get_issues(changed).await?;
let diags = get_diagnostics(changed).await?;
Ok((issues, diags))
},
|_| {
|ctx| {
let (issues, diags) = ctx.value;
Ok(vec![TurbopackResult {
result: (),
issues: vec![],
diagnostics: vec![],
issues: issues.iter().map(|i| NapiIssue::from(&**i)).collect(),
diagnostics: diags.iter().map(|d| NapiDiagnostic::from(d)).collect(),
}])
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1492,6 +1492,11 @@ async function startWatcher(opts: SetupOpts) {
)

changeSubscription(page, route.rscEndpoint, (_page, change) => {
if (change.issues.some((issue) => issue.severity === 'error')) {
// Ignore any updates that has errors
// There will be another update without errors eventually
return
}
switch (change.type) {
case ServerClientChangeType.Server:
case ServerClientChangeType.Both:
Expand Down
Loading