Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Course elements persistence #899

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions src/web/src/pages/NewCourseScheduler.vue
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,14 @@ export default {
loadedIndexCookie: 0,
};
},
mounted() {
// Reload the schedule when the component is mounted
this.reloadSchedule();
},
// NEW: When the component is re-activated (if using keep-alive), reload the schedule
activated() {
this.reloadSchedule();
},
methods: {
toggleNav() {
this.isNavOpen = !this.isNavOpen;
Expand Down Expand Up @@ -468,9 +476,8 @@ export default {
(section) => section.crn === selectedSectionCrn
);

section.selected = true;
}
);
section.selected = true;
});
});
} catch (err) {
// If there is an error here, it might mean the data was changed,
Expand Down Expand Up @@ -670,6 +677,12 @@ export default {
.updateIndex(this.index)
.save();
},
// Reload the schedule when returning to this page
reloadSchedule() {
if (Object.keys(this.selectedCourses).length > 0) {
this.getSchedules();
}
},
},
computed: {
...mapState(["subsemesters", "selectedSemester"]),
Expand Down Expand Up @@ -728,6 +741,12 @@ export default {
},
},
watch: {
// ─── Watch for route changes to trigger schedule reload ──────────────
$route(to) {
if (to.name === "SchedulePage") {
this.reloadSchedule();
}
},
courses: {
immediate: true,
handler() {
Expand Down