From 5fbc77bc32ad88c93bb2da3b9e6f05acecf1682e Mon Sep 17 00:00:00 2001 From: Tobias Laufersweiler <43147776+TobiasLaufersweiler@users.noreply.github.com> Date: Thu, 19 Nov 2026 12:49:31 +0100 Subject: [PATCH] Do not ask for unsaved changes twice when switching to a schema with a contents list extension (#1386) --- .../content/pages/content/content-page.component.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/features/content/pages/content/content-page.component.ts b/frontend/src/app/features/content/pages/content/content-page.component.ts index e74b857a4..276bb290d 100644 --- a/frontend/src/app/features/content/pages/content/content-page.component.ts +++ b/frontend/src/app/features/content/pages/content/content-page.component.ts @@ -11,7 +11,7 @@ import { FormsModule } from '@angular/forms'; import { ActivatedRoute, Router, RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router'; import { firstValueFrom, Observable, of } from 'rxjs'; import { tap } from 'rxjs/operators'; -import { AnnotationCreate, AnnotationCreateAfterNavigate, AnnotationsSelected, AnnotationsSelectedAfterNavigate, ApiUrlConfig, AppLanguageDto, AppsState, AuthService, AutoSaveKey, AutoSaveService, CanComponentDeactivate, CollaborationService, CommentsState, ConfirmClickDirective, ContentDto, ContentsState, DialogService, DropdownMenuComponent, EditContentForm, LanguageSelectorComponent, LanguagesState, LayoutComponent, LocalStoreService, MessageBus, ModalDirective, ModalModel, ModalPlacementDirective, NotifoComponent, PreviousUrl, queryParam, ResolveAssets, ResolveContents, SchemaDto, SchemasState, Settings, ShortcutDirective, SidebarMenuDirective, TempService, TitleComponent, ToolbarComponent, ToolbarService, TooltipDirective, TourHintDirective, TourStepDirective, TranslatePipe, Types, Version, WatchingUsersComponent } from '@app/shared'; +import { allParams, AnnotationCreate, AnnotationCreateAfterNavigate, AnnotationsSelected, AnnotationsSelectedAfterNavigate, ApiUrlConfig, AppLanguageDto, AppsState, AuthService, AutoSaveKey, AutoSaveService, CanComponentDeactivate, CollaborationService, CommentsState, ConfirmClickDirective, ContentDto, ContentsState, DialogService, DropdownMenuComponent, EditContentForm, LanguageSelectorComponent, LanguagesState, LayoutComponent, LocalStoreService, MessageBus, ModalDirective, ModalModel, ModalPlacementDirective, NotifoComponent, PreviousUrl, queryParam, ResolveAssets, ResolveContents, SchemaDto, SchemasState, Settings, ShortcutDirective, SidebarMenuDirective, TempService, TitleComponent, ToolbarComponent, ToolbarService, TooltipDirective, TourHintDirective, TourStepDirective, TranslatePipe, Types, Version, WatchingUsersComponent } from '@app/shared'; import { ContentExtensionComponent } from '../../shared/content-extension.component'; import { PreviewButtonComponent } from '../../shared/preview-button.component'; import { ContentEditorComponent } from './editor/content-editor.component'; @@ -361,6 +361,12 @@ export class ContentPageComponent implements CanComponentDeactivate { return of(true); } + const schemaName = allParams(this.route)['schemaName']; + const schema = this.schema(); + if (schemaName !== schema.name && schemaName !== schema.id) { + return of(true); + } + return this.contentForm().hasChanged() ? this.dialogs.confirm('i18n:contents.pendingChangesTitle', text) : of(true);