fix(perf): resolve slow navigation lag by introducing signed session cookies and deferred query streamingFix/navigation performance#134
Open
priymavani wants to merge 3 commits into
Conversation
|
@priymavani is attempting to deploy a commit to the participationcorner2025-8967's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Codesense Ai: This PR is too large to review automatically. A human maintainer will take a look! |
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.
Description
This PR resolves the page navigation freeze when switching between authenticated sections (Dashboard, Inventory, Market Prices, Sales Log, Expenses, AI Insights, Settings, Income Statement, and Price Alerts).
What was causing the lag?
await supabase.auth.getUser()network query to verify the session. Since React Router resolves transitions concurrently, parallel checks blocked navigation.Solutions Implemented:
Signed Session Cookies (
__ft_auth_session):createCookieSessionStoragesigned with the project'sENCRYPTION_SECRET.<1ms(zero network calls). Remote Supabase Auth is only called as a fallback.Layout Opt-Out Revalidation:
shouldRevalidate: () => falseon the parent layout (app-layout.tsx) to avoid repeat auth checks on sibling navigations.Data Deferral & Streaming (React Router v7
deferAPI):<Suspense>and<Await>to instantly mount page frames (<100ms) while data details stream asynchronously.@tabler/icons-reacton all pages.Security Best Practices Adhered To:
process.env.findUnique,findMany, etc.), avoiding raw SQL string interpolation.where: { userId: user.id }).Related Issues
This PR fixes an open issue #128
Type of Change
Checklist:
🎥 Verification Recording:
navigation_fix.mp4