Make scheduling feel instant#23
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR is a broad perceived-performance pass for the scheduling and plan-building workflows. The goal is to make the app feel closer to Linear-style local-first interactions while still respecting that Planning Center itself can be slow.
The main strategy is not a new vendor or external cache. Instead, this uses optimistic UI, local warm caches, React Query cache hydration, request dedupe, targeted prefetching, and delayed reconciliation so the user sees immediate feedback while the slow network work finishes in the background.
Strategy
1. Make mutations feel instant
Scheduling, status changes, unscheduling, and plan item edits now update the local UI immediately before Planning Center responds.
2. Stop making active views wait on immediate refetches
The old flow often invalidated and refetched the active view immediately after a write, which made successful actions feel like they flickered or stalled.
This PR keeps inactive queries invalidated, but delays active-view reconciliation briefly. The visible screen stays optimistic and responsive, then quietly refetches after the interaction settles.
3. Use warm local snapshots without breaking hydration
A set of small localStorage-backed caches now covers the expensive read paths:
Those caches hydrate React Query after mount through a shared helper so the first client render still matches SSR. This avoids React hydration warnings while preserving fast warm starts.
4. Reduce Planning Center request volume
Shared Planning Center service wrappers now dedupe or cache high-volume reads:
Caches return defensive clones so callers cannot accidentally mutate shared cached data.
5. Prefetch where intent is clear
Several UI paths now warm the next likely data before the user clicks:
6. Make loading states stable instead of jarring
This adds route-shaped Suspense fallbacks for schedule pages and uses placeholder data to avoid tearing down whole views during selection changes.
Hydration issues found during browser verification were also cleaned up:
initialData7. UI hygiene from the performance pass
The Plan page row interaction areas changed during the optimistic Plan work, so this PR also cleans them up:
Behavior changes
Safety notes
Test coverage
Added or expanded focused tests for:
Verification
bun run lintbun run typecheckbun run testgit diff --checkhttp://localhost:3000/schedule/plan?serviceTypeId=78289&planId=86407886&teamId=260369&positionId=1314760&view=plan