Skip to content

perf(web): defer non critical app load work#1081

Open
ved015 wants to merge 1 commit into
mainfrom
fix/loading
Open

perf(web): defer non critical app load work#1081
ved015 wants to merge 1 commit into
mainfrom
fix/loading

Conversation

@ved015

@ved015 ved015 commented Jun 10, 2026

Copy link
Copy Markdown
Member

Summary

  • Let the app shell render after org list restore, then hydrate the full organization in the background.
  • Defer non-critical dashboard/support calls until after initial render:
    • recents
    • connections
    • MCP status
    • API keys/tool usage
    • tool documents
    • personalization search
    • container tags
    • org summaries
  • Remove eager Autumn customer loading from the header so billing state does not compete with app boot.
  • Delay PostHog initialization so analytics does not run during the first render window.

Why

Initial load was doing too much work at once. Only session/org context is needed to enter the app shell; dashboard suggestions, billing plan display, analytics, and secondary metadata can load shortly after.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
supermemory-mcp a8be1d2 Jun 10 2026, 08:42 AM

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
supermemory-app a8be1d2 Commit Preview URL

Branch Preview URL
Jun 10 2026, 08:42 AM

@graphite-app graphite-app Bot requested a review from Dhravya June 10, 2026 08:53
@claude

claude Bot commented Jun 10, 2026

Copy link
Copy Markdown

Claude finished @ved015's task in 3m 8s —— View job


Review Complete

  • Fetching PR diff and existing review comments
  • Analyzing changed files for bugs and security issues
  • Checking surrounding code for edge cases
  • Submitting review

Summary: This PR cleanly defers non-critical app load work to improve initial render performance. All timeout patterns have proper cleanup, race conditions are handled with cancelled flags, and hook interfaces remain backward compatible. No bugs, security issues, or logic errors found.

Score: 9/10 — Good to ship.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Overview: Defers non-critical data fetching (recents, connections, MCP status, billing, analytics) until after the initial app shell renders by introducing 900-1500ms timeouts and gating queries behind enabled flags.

Issues found: None — this looks good to ship.

The implementation is clean:

  • All setTimeout calls have proper cleanup functions in their useEffect returns
  • The cancelled flag pattern in auth-context.tsx correctly prevents stale state updates after unmount
  • The OrganizationListItemOrganization cast is safe since hydrateFullOrg() runs immediately after and any field differences are short-lived
  • PostHog deferral correctly captures the initial pageview in the loaded callback, avoiding duplicates with PostHogPageTracking
  • Hook interfaces remain backward compatible (usePersonalization defaults enabled: true)

Score: 9/10

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.

1 participant