Signed-in pages load about 1.9 MB of data they do not use #63
Labels
No labels
bug
chore
data
feature
frontend
good first issue
intermediate
needs/docs
needs/research
needs/upstream
type/bug
type/external
type/feature
type/refactor
urgency
high
urgency
immediate
urgency
low
urgency
medium
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
ScottyLabs/cal#63
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What's wrong
Every signed-in page downloads about 1.9 MB of API data, including on pages that never show it, and some requests are duplicated. Pages load slower than they need to, especially on phones.
How to reproduce
events/?term=&tags=&date=(about 1.35 MB),schedule/(about 537 KB),users/meandusers/get_user_id.events/{id}/tagsis requested twice.Expected
Each page loads only what it shows, and nothing is fetched twice.
Where to look
web/src/context/UserContext.tsx:fetchEventsruns on every page, but onlySearchResultSidebar.tsxreadsallEvents. Load it from Explore instead.web/src/context/UserContext.tsx:fetchSchedulealso runs everywhere. The navbar picker waits forcurrentScheduleId, which this call sets, so keep the picker working if /manager skips it.web/src/app/components/Navbar.tsx:getUserID()(/users/get_user_id) runs before the schedules and role calls, but AuthContext already loads/users/me(dbUser.id). Drop it and start the other two right away.web/src/app/components/ModalRender.tsx: mounts bothModalEventandEventPopover(CSS hides one), so both fetch tags. Render only one, for example withuseIsMobile()./events/response; coordinate.Done when
/and/managerno longer request/events/./users/get_user_idis no longer requested on page load.