Skip to content

feat: added courses loading skeleton#1608

Merged
dsnsgithub merged 15 commits into
mainfrom
fix/distinguish-loading-state
May 21, 2026
Merged

feat: added courses loading skeleton#1608
dsnsgithub merged 15 commits into
mainfrom
fix/distinguish-loading-state

Conversation

@dsnsgithub
Copy link
Copy Markdown
Member

@dsnsgithub dsnsgithub commented Apr 13, 2026

Summary

  • Distinguish loading state from empty state through a loading skeleton for the added pane.
  • Modifies the course skeleton to be closer to the new, lighter MUI skeleton components.
Screen.Recording.2026-05-20.at.9.18.00.PM.mov

Issues

Fixes inability to distinguish loading state from empty state.
chrome-capture-2026-4-12
(from Kevin)

Closes #1718

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

@KevinWu098
Copy link
Copy Markdown
Member

How's progress here?

@dsnsgithub
Copy link
Copy Markdown
Member Author

dsnsgithub commented Apr 19, 2026

How's progress here?

I modified the colors of the calendar and course loading skeleton to be slightly lighter, so it should be ready for review.

@dsnsgithub dsnsgithub requested a review from KevinWu098 April 19, 2026 22:52
Copy link
Copy Markdown
Member

@KevinWu098 KevinWu098 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A handful of comments — feature looks good, but just hoping to flesh out the implementation a bit more

Comment thread apps/antalmanac/src/components/Calendar/CalendarRoot.tsx Outdated
Comment thread apps/antalmanac/src/lib/localStorage.ts
Comment thread apps/antalmanac/src/components/RightPane/SectionTable/SectionTableLazyWrapper.tsx Outdated
Comment thread apps/antalmanac/src/components/RightPane/AddedCourses/AddedCoursePane.tsx Outdated
Comment thread apps/antalmanac/src/components/RightPane/LoadingSkeleton.tsx Outdated
Comment thread apps/antalmanac/src/components/RightPane/LoadingSkeleton.tsx Outdated
@KevinWu098
Copy link
Copy Markdown
Member

i promise ill take a look at this soon, in the meanwhile do you mind handling the conflicts

Distinguish loading state from empty state in the added courses pane
by rendering a skeleton derived from a blueprint persisted to
localStorage.

The skeleton is rendered only when openLoadingSchedule is true AND a
blueprint exists. When no blueprint is available, the loading state
renders nothing, falling through to the empty state once loading
completes (mirroring the calendar's empty-state behavior).

Closes #1718

Co-authored-by: Dominic Seung <dominic@seung.dev>
@dsnsgithub dsnsgithub force-pushed the fix/distinguish-loading-state branch from 7d03c42 to b0a6a9a Compare May 18, 2026 07:20
@dsnsgithub dsnsgithub force-pushed the fix/distinguish-loading-state branch from 4963ceb to a931cdd Compare May 18, 2026 07:36
Co-authored-by: Dominic Seung <dominic@seung.dev>
- Move SectionTable's wrapSkeleton helper to module scope so it isn't
  reallocated each render.

- Slim the persisted blueprint by stripping each section to an empty
  object. The skeleton only needs sections.length to render its stub
  rows, so persisting full meetings/instructors/enrollment bloated
  localStorage for nothing. SectionTable's skeleton mode now renders
  stub TableRows (with a variant="text" Skeleton per cell) instead of
  the full SectionTableBody, which is what makes the slim shape safe.

- Subscribe AddedCoursesLoadingSkeleton to scheduleNamesChange so the
  cached names don't go stale while the skeleton is mounted (matches
  AddedSectionsGrid's pattern).

- Drive the calendar's skeleton event color from
  theme.palette.action.disabledBackground instead of a hardcoded
  #9d9d9d, so it picks up dark mode. Skip colorContrastSufficient for
  skeleton events since the theme color is rgba() and skeleton titles
  are empty anyway.

Co-authored-by: Dominic Seung <dominic@seung.dev>
@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai Bot commented May 19, 2026

You're iterating quickly on this pull request. To help protect your rate limits, cubic has paused automatic reviews on new pushes for now—when you're ready for another review, comment @cubic-dev-ai review.

- Memoize readCachedCourses via useState lazy init so it no longer
  hits localStorage / JSON.parse / validation on every render of
  AddedCoursesLoadingSkeleton (state updates from scheduleNamesChange
  used to retrigger it).

- Add pointerEvents: none to the Skeleton wrappers in SectionTable's
  skeleton mode. The wrapped children already have visibility: hidden
  (from MUI's children-aware Skeleton), which blocks events in
  practice — but pointer-events: none on the wrapper is a belt-and-
  suspenders guard so the collapse chevron, drag handle, and syllabi
  popover cannot fire while the skeleton is visible.

- Drop courseComment and prerequisiteLink contents from the persisted
  blueprint (replace with ''). They're the heaviest fields a course
  can carry, and SectionTable's skeleton mode never displays them.

- Trim a comment in CalendarRoot that referenced the current
  implementation of colorContrastSufficient.

Co-authored-by: Dominic Seung <dominic@seung.dev>
Stripping sections to {} + rendering stub <TableRow><Skeleton variant="text"/></TableRow>
in skeleton mode shrank localStorage but assumed every row was one
line tall. Real rows wrap when a section has multiple instructors or
multi-line meetings, so the skeleton came up short and caused a
layout shift downward when the real schedule rendered.

Revert that pair of changes: persist the full sections array and let
SectionTable's skeleton mode render the real SectionTableBody under
its children-aware Skeleton, so the placeholder matches the real
table's height per row.

Keep the other slim — courseComment and prerequisiteLink are still
dropped (replaced with empty strings) since neither contributes to
visible skeleton dimensions and courseComment in particular can be
large.

Co-authored-by: Dominic Seung <dominic@seung.dev>
@dsnsgithub
Copy link
Copy Markdown
Member Author

@cubic-dev-ai review

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai Bot commented May 19, 2026

@cubic-dev-ai review

@dsnsgithub I have started the AI code review. It will take a few minutes to complete.

…ng-state

# Conflicts:
#	apps/antalmanac/src/components/Calendar/CalendarRoot.tsx
#	apps/antalmanac/src/components/RightPane/SectionTable/SectionTable.tsx
Copy link
Copy Markdown
Contributor

@vicksey vicksey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Tested on staging the skeleton loads and smoothly transitions to the sections when the data loads.

I just noticed 1 small thing for consistency sake: custom events don't have a skeleton on the added pane. I think it's worth adding since on the calendar pane custom events load with a skeleton.

Besides that nice pr!

The cached blueprint now stores both courses and customEvents so the
skeleton renders the previous schedule's full added-pane shape, not
just the SectionTables. CustomEventDetailView grows a `skeleton` prop
that wraps the rendered Card in MUI's children-aware Skeleton — the
hidden Card contributes layout, so each placeholder sizes to the real
card it will be replaced by.

AddedSectionsGrid subscribes to customEventsChange and re-persists on
each event so a change in either list keeps the blueprint up to date.
Legacy blueprints (plain array of courses) are still accepted on read
for backwards compatibility — they just render an empty Custom Events
section.

Co-authored-by: Dominic Seung <dominic@seung.dev>
@dsnsgithub
Copy link
Copy Markdown
Member Author

dsnsgithub commented May 21, 2026

Custom events should now also have a skeleton (only when the user has any in their schedule).

@dsnsgithub dsnsgithub requested a review from vicksey May 21, 2026 04:25
Copy link
Copy Markdown
Contributor

@vicksey vicksey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀 🔥 ✅

@dsnsgithub dsnsgithub removed the request for review from KevinWu098 May 21, 2026 21:35
@dsnsgithub dsnsgithub merged commit 3875309 into main May 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Courses Loading Skeleton

4 participants