-
Notifications
You must be signed in to change notification settings - Fork 91
refactor: fallback schedules #1209
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
base: main
Are you sure you want to change the base?
Conversation
apps/antalmanac/src/routes/Home.tsx
Outdated
| <MuiPickersUtilsProvider utils={DateFnsUtils}> | ||
| <PatchNotes /> | ||
| <InstallPWABanner /> | ||
| {/* <InstallPWABanner /> */} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InstallPWABanner was already disabled via #1213, this just further ensures none of its logic is applied unnecessarily
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just throw it on another PR. It's one line. I'll review it in a snap.
MinhxNguyen7
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem to work. I tried to load the test schedule (which has classes), and nothing showed up in the added pane.
|
@KevinWu098 Reminder |
MinhxNguyen7
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apps/antalmanac/src/routes/Home.tsx
Outdated
| <MuiPickersUtilsProvider utils={DateFnsUtils}> | ||
| <PatchNotes /> | ||
| <InstallPWABanner /> | ||
| {/* <InstallPWABanner /> */} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just throw it on another PR. It's one line. I'll review it in a snap.
| } | ||
|
|
||
| deleteCustomEvent(customEventId: number, scheduleIndices: number[]) { | ||
| deleteCustomEvent(customEventId: number | string, scheduleIndices: number[]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this suddenly accepting a string? What's the type for a custom event on the backend? It should just be consistent instead of allowing anything
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes some type errors we've had for a while post-RDS
| */ | ||
| doesCustomEventExistInSchedule(customEventId: number, scheduleIndex: number) { | ||
| for (const customEvent of this.schedules.at(scheduleIndex)?.customEvents ?? []) { | ||
| doesCustomEventExistInSchedule(customEventId: string | number, scheduleIndex: number) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing about the types
Oops. I forgot about that |


Summary
Refactors away the SkeletonSchedule from our (soon-to-be legacy) Schedules store to a Zustand store. Removes event emitters, updates logic for reading and writing skeleton schedules.
This PR largely removes the old event emitter + event listener + useEffect pattern we had in many of our components in favor of Zustand's useStore hook. In some cases, this required additional logic changes (e.g. ScheduleSelect), but the PR is mostly refactoring.
Test Plan
Skeleton Schedules trigger when a user's schedule cannot be fully loaded because the AnteaterAPI is down. This results in us only having access to select fields (what AA stores on our DB), which are primarily the schedule names, custom events, schedule notes, and the course ID of the added courses.
For testing, you'll need to block requests to the AnteaterAPI via Chrome Dev Tools, then attempt to load a schedule with courses added. Fallback does not trigger if there are no courses, as it would make no requests to the API. Blocking the keyword
websocshould work here.Fallback should trigger immediately when the API request fails, displaying schedules correctly and blocking features which could require API data (e.g. save, load, editing).
Issues
Closes #1208