Unverified Commit dee316c4 authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

Turbopack: avoid sending serverComponentChanges with errors (#57425)

We don't want to send the serverComponentChanges event until the
compilation is free of errors.

Closes WEB-1859
parent 8a4b0f16
......@@ -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(),
}])
},
)
......
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment