Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@leslieyip02 @jloh02 Patch for #4225, for the issue reported on the morning of 16 Dec by LH (https://t.me/NUSMods/13136)
Important Note: While this patch preserves the current behavior of the app, I think it is more prudent to add more error checking to the migration process, and to stop the migration if an error is encountered, because migrating the config is an inherently destructive process (it overwrites the old config).
I am currently working on that.This patch should be considered superseded by #4272When the app fetches the timetable modules, it populates the lesson indices which allows the migration of the module config to the new schema
nusmods/website/src/reducers/moduleBank.ts
Lines 47 to 60 in d31261e
The issue was caused by
nusmods/website/src/views/AppShell.tsx
Lines 64 to 66 in d31261e
calling
nusmods/website/src/actions/timetables.ts
Lines 231 to 239 in d31261e
When
validateTimetable(1)is called when the app successfully fetches the module data for semester 1, it callsmigrateTimetableConfigswhich migrates the configs for all semesters, including semester 2. Since the request for semester 2 has not returned, the lesson indices has not been populated for semester 2 (see point 1). Trying to migrate the config for semester 2 will thus fail.This patch fixes this issue by removing the
migrateTimetableConfigsfunction and instead migrates each semester's timetable config as data is fetched for each of the semester.