From dd102aa87c09924b835a275b802e08a74f00dcee Mon Sep 17 00:00:00 2001 From: Krrish Ghimire Date: Thu, 2 Jul 2026 01:35:17 +0545 Subject: [PATCH] fix version selection while switching sites --- .../llm-workspace/llm-workspace.component.ts | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/frontend/src/app/llm-workspace/llm-workspace.component.ts b/frontend/src/app/llm-workspace/llm-workspace.component.ts index 9866649..636804f 100644 --- a/frontend/src/app/llm-workspace/llm-workspace.component.ts +++ b/frontend/src/app/llm-workspace/llm-workspace.component.ts @@ -275,12 +275,20 @@ export class LlmWorkspaceComponent implements OnInit, OnDestroy { private destroy$ = new Subject(); ngOnInit(): void { - this.siteId = this.route.snapshot.paramMap.get('siteId'); - const existingPrompt = this.session.currentPrompt; - if (existingPrompt) { - this.prompt = existingPrompt; - } - this.loadVersions(); + this.route.paramMap + .pipe(takeUntil(this.destroy$)) + .subscribe(params => { + const siteId = params.get('siteId'); + if (siteId !== this.siteId) { + this.siteId = siteId; + this.prompt = ''; + this.refinePrompt = ''; + this.showRefine = false; + this.versions = []; + this.session.clearHistory(); + this.loadVersions(); + } + }); } private loadVersions(): void {