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.
This commit is contained in:
Jono M 2023-12-12 11:27:59 +00:00 committed by GitHub
parent 95eaaad459
commit 2b85980302
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}
}
};