From 2b859803026839c8da5755d14857328c7b68c104 Mon Sep 17 00:00:00 2001 From: Jono M Date: Tue, 12 Dec 2023 11:27:59 +0000 Subject: [PATCH] Fixed theme template picker state syncing with AdminX (#19328) refs PROD-235 Special case where we need to set the old theme to inactive after activating a new theme. --- ghost/admin/app/components/admin-x/admin-x-component.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ghost/admin/app/components/admin-x/admin-x-component.js b/ghost/admin/app/components/admin-x/admin-x-component.js index ac1ca0b79e..0be6116504 100644 --- a/ghost/admin/app/components/admin-x/admin-x-component.js +++ b/ghost/admin/app/components/admin-x/admin-x-component.js @@ -179,7 +179,12 @@ export default class AdminXComponent extends Component { const activated = response.themes.find(theme => theme.active); if (activated) { - this.themeManagement.activeTheme = this.store.peekAll('theme').filterBy('name', activated.name).firstObject; + const previouslyActive = this.store.peekAll('theme').find(theme => theme.active && theme.name !== activated.name); + previouslyActive?.set('active', false); + + const newlyActive = this.store.peekAll('theme').filterBy('name', activated.name).firstObject; + newlyActive?.set('active', true); + this.themeManagement.activeTheme = newlyActive; } } };