chore: show innermost error in ui mode (#26840)

This commit is contained in:
Pavel Feldman 2023-09-01 13:48:15 -07:00 committed by GitHub
parent a339bead09
commit 1c5f53f216
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View File

@ -96,4 +96,5 @@
.call-tab .error-message { .call-tab .error-message {
padding: 5px; padding: 5px;
line-height: 17px;
} }

View File

@ -90,6 +90,11 @@ export class MultiTraceModel {
this.resources.sort((a1, a2) => a1._monotonicTime! - a2._monotonicTime!); this.resources.sort((a1, a2) => a1._monotonicTime! - a2._monotonicTime!);
this.sources = collectSources(this.actions); this.sources = collectSources(this.actions);
} }
failedAction() {
// This find innermost action for nested ones.
return this.actions.findLast(a => a.error);
}
} }
function indexModel(context: ContextEntry) { function indexModel(context: ContextEntry) {

View File

@ -65,7 +65,7 @@ export const Workbench: React.FunctionComponent<{
React.useEffect(() => { React.useEffect(() => {
if (selectedAction && model?.actions.includes(selectedAction)) if (selectedAction && model?.actions.includes(selectedAction))
return; return;
const failedAction = model?.actions.find(a => a.error); const failedAction = model?.failedAction();
if (initialSelection && model?.actions.includes(initialSelection)) if (initialSelection && model?.actions.includes(initialSelection))
setSelectedAction(initialSelection); setSelectedAction(initialSelection);
else if (failedAction) else if (failedAction)