diff --git a/src/components/Requirements/MultiplePlansDropdown.vue b/src/components/Requirements/MultiplePlansDropdown.vue index a3923270f..347ea0676 100644 --- a/src/components/Requirements/MultiplePlansDropdown.vue +++ b/src/components/Requirements/MultiplePlansDropdown.vue @@ -87,6 +87,7 @@ export default defineComponent({ 'setCurrentPlan', store.state.plans.find(p => p.name === plan) ); + store.commit('setOrderByNewest', store.state.orderByNewest); this.shown = !this.shown; } }, diff --git a/src/components/Requirements/RequirementSideBar.vue b/src/components/Requirements/RequirementSideBar.vue index 8e5187a66..ab86deabe 100644 --- a/src/components/Requirements/RequirementSideBar.vue +++ b/src/components/Requirements/RequirementSideBar.vue @@ -393,6 +393,7 @@ export default defineComponent({ 'setCurrentPlan', store.state.plans.find(plan => plan.name === name) ); + store.commit('setOrderByNewest', store.state.orderByNewest); this.confirmationText = `${oldname} has been renamed to ${name}!`; this.isConfirmationOpen = true; setTimeout(() => { diff --git a/src/global-firestore-data/user-semesters.ts b/src/global-firestore-data/user-semesters.ts index 98ede8ae5..f03e663ae 100644 --- a/src/global-firestore-data/user-semesters.ts +++ b/src/global-firestore-data/user-semesters.ts @@ -28,6 +28,7 @@ export const editPlans = async ( await updateDoc(doc(semestersCollection, store.state.currentFirebaseUser.email), { plans, }); + store.commit('setOrderByNewest', store.state.orderByNewest); }; /** * Sets whether semesters are ordered by newest/oldest diff --git a/src/store.ts b/src/store.ts index c07494b43..6a5dc8d26 100644 --- a/src/store.ts +++ b/src/store.ts @@ -177,7 +177,9 @@ const store: TypedVuexStore = new TypedVuexStore({ name: state.currentPlan.name, semesters: sortedSemesters(semesters, state.orderByNewest), }; - const editedPlans = state.plans.map(plan => (plan === state.currentPlan ? editedPlan : plan)); + const editedPlans = state.plans.map(plan => + plan.name === state.currentPlan.name ? editedPlan : plan + ); state.plans = editedPlans; state.currentPlan = editedPlan; },