diff --git a/frontend/src/stores/portfolio.ts b/frontend/src/stores/portfolio.ts index be3799c9ff..5c838b7e0a 100644 --- a/frontend/src/stores/portfolio.ts +++ b/frontend/src/stores/portfolio.ts @@ -66,6 +66,7 @@ export function createPortfolioStore(subscriptions: SubscriptionsRouter, editor: subscriptions.subscribeFrontendMessage("UpdateOpenDocumentsList", (data) => { update((state) => { state.documents = data.openDocuments; + if (state.documents.length === 0) state.activeDocumentIndex = 0; return state; }); });