From d91e5e5789a5a8a5276f5e7c1118fc121380cdfc Mon Sep 17 00:00:00 2001 From: Richard Knoll Date: Tue, 17 Feb 2026 20:58:05 +0000 Subject: [PATCH] keep the error list collapsed if collapsed by user --- localtypings/pxteditor.d.ts | 1 + webapp/src/blocks.tsx | 8 ++++++++ webapp/src/errorList.tsx | 10 ++++++++++ webapp/src/monaco.tsx | 8 ++++++++ 4 files changed, 27 insertions(+) diff --git a/localtypings/pxteditor.d.ts b/localtypings/pxteditor.d.ts index 357abd7f4855..f89e4e79db6d 100644 --- a/localtypings/pxteditor.d.ts +++ b/localtypings/pxteditor.d.ts @@ -820,6 +820,7 @@ declare namespace pxt.editor { simSerialActive?: boolean; deviceSerialActive?: boolean; errorListState?: ErrorListState; + errorListCollapsedByUser?: boolean; screenshoting?: boolean; extensionsVisible?: boolean; isMultiplayerGame?: boolean; // Arcade: Does the current project contain multiplayer blocks? diff --git a/webapp/src/blocks.tsx b/webapp/src/blocks.tsx index 22f00cb344b5..8cf82f6dddac 100644 --- a/webapp/src/blocks.tsx +++ b/webapp/src/blocks.tsx @@ -1092,6 +1092,8 @@ export class Editor extends toolboxeditor.ToolboxEditor { { + this.parent.setState({ + errorListCollapsedByUser: collapsed + }); + } + onExceptionDetected(exception: pxsim.DebuggerBreakpointMessage) { const displayInfo: ErrorDisplayInfo = this.getDisplayInfoForException(exception); this.errors = [displayInfo]; diff --git a/webapp/src/errorList.tsx b/webapp/src/errorList.tsx index ccf318e4edba..55cb7c4192ba 100644 --- a/webapp/src/errorList.tsx +++ b/webapp/src/errorList.tsx @@ -44,6 +44,8 @@ export interface ErrorListProps { continuationHash?: string, dialogMessages?: { signInMessage?: string; signUpMessage?: string } ) => void; + collapsedByUser?: boolean; + onUserCollapse?: (collapsed: boolean) => void; } export interface ErrorListState { @@ -64,6 +66,10 @@ export class ErrorList extends auth.Component { } componentDidUpdate(prevProps: Readonly, prevState: Readonly, snapshot?: any): void { + if (this.props.collapsedByUser) { + return; + } + // Auto-expand if there are new errors if (this.props.errors.length > 0 && this.state.isCollapsed) { let shouldExpand = this.props.errors.length > prevProps.errors.length; @@ -192,6 +198,10 @@ export class ErrorList extends auth.Component { pxt.tickEvent('errorlist.collapse', null, { interactiveConsent: true }) } + if (this.props.onUserCollapse) { + this.props.onUserCollapse(!this.state.isCollapsed); + } + this.setState({ isCollapsed: !this.state.isCollapsed }, this.onDisplayStateChange); diff --git a/webapp/src/monaco.tsx b/webapp/src/monaco.tsx index 6b9779649091..eab4bb3bc3c5 100644 --- a/webapp/src/monaco.tsx +++ b/webapp/src/monaco.tsx @@ -664,6 +664,8 @@ export class Editor extends toolboxeditor.ToolboxEditor { {showErrorList && ( { + this.parent.setState({ + errorListCollapsedByUser: collapsed + }); + } + prepare() { this.isReady = true }