fix(color): deleting last screen may not update the UI and corrupt model yaml file (#6887)

This commit is contained in:
philmoz
2025-12-19 21:58:01 +10:00
committed by GitHub
parent 2fc9171ed9
commit f77a791683
@@ -213,9 +213,14 @@ void ScreenSetupPage::build(Window* window)
// ... and reload
LayoutFactory::loadCustomScreens();
// Reset to first screen so user knows something has happened
// adjust index if last screen deleted
if (customScreens[customScreenIndex] == nullptr) customScreenIndex -= 1;
PageGroup* menu = (PageGroup*)window->getParent();
menu->setCurrentTab(QuickMenu::pageIndex(QM_UI_SCREEN1));
// Reset to setup page to ensure screen properly updates.
menu->setCurrentTab(QuickMenu::pageIndex(QM_UI_SETUP));
// Reset to original (or adjusted screen)
menu->setCurrentTab(QuickMenu::pageIndex((QMPage)(QM_UI_SCREEN1 + customScreenIndex)));
storageDirty(EE_MODEL);
return 0;