@@ -536,7 +536,17 @@ FocusScope {
536 if (!priv.mainStageItemId) return 0;
536 if (!priv.mainStageItemId) return 0;
538 if (priv.sideStageItemId && priv.nextInStack > 0) {
538 if (priv.sideStageItemId && priv.nextInStack > 0) {
540+ // Due the order in which bindings are evaluated, this might be triggered while shuffling
541+ // the list and index doesn't yet match with itemIndex (even though itemIndex: index)
542+ // Let's walk the list and compare itemIndex to make sure we have the correct one.
543+ var nextDelegateInStack = -1;
544+ for (var i = 0; i < appRepeater.count; i++) {
539− var nextDelegateInStack = appRepeater.itemAt(priv.nextInStack);
545+ if (appRepeater.itemAt(i).itemIndex == priv.nextInStack) {
546+ nextDelegateInStack = appRepeater.itemAt(i);
541 if (nextDelegateInStack.stage === ApplicationInfoInterface.MainStage) {
551 if (nextDelegateInStack.stage === ApplicationInfoInterface.MainStage) {
542 // if the next app in stack is a main stage app, put the sidestage on top of it.
552 // if the next app in stack is a main stage app, put the sidestage on top of it.
@@ -727,8 +737,11 @@ FocusScope {
727 spreadItem.highlightedIndex = index
737 spreadItem.highlightedIndex = index
728 priv.goneToSpread = false;
738 priv.goneToSpread = false;
740+ if (root.mode == "stagedWithSideStage") {
730− if (appDelegate.stage == ApplicationInfoInterface.SideStage && !sideStage.shown && root.mode == "stagedWithSideStage") {
741+ if (appDelegate.stage == ApplicationInfoInterface.SideStage && !sideStage.shown) {
731− sideStage.show();
742+ sideStage.show();
744+ priv.updateMainAndSideStageIndexes();
734 if (root.mode == "windowed") {
747 if (root.mode == "windowed") {