René's URL Explorer Experiment


Title: refactor(frontend-arch): migrate server state to React Query, collapse duplicate workflow-state cache, granular error boundaries by waleedlatif1 · Pull Request #5168 · simstudioai/sim · GitHub

Open Graph Title: refactor(frontend-arch): migrate server state to React Query, collapse duplicate workflow-state cache, granular error boundaries by waleedlatif1 · Pull Request #5168 · simstudioai/sim

X Title: refactor(frontend-arch): migrate server state to React Query, collapse duplicate workflow-state cache, granular error boundaries by waleedlatif1 · Pull Request #5168 · simstudioai/sim

Description: Summary SessionProvider → React Query — replace the hand-rolled useState/useEffect/loadSession with a useSessionQuery() hook. Context shape is byte-identical ({ data, isPending, error, refetch }) so all 34 consumers are untouched. The ?upgraded path still forces a fresh DB read via getSession({ disableCookieCache: true }) + setQueryData (refetch can't pass that flag), now guarded by cancelQueries so a late-resolving stale mount fetch can't clobber the fresh session. Collapse the duplicate workflow-state cache — the registry store fetched the GET /api/workflows/[id] envelope inline while useWorkflowState cached the same endpoint's mapped state separately (two requests, two shapes, never reconciled). Now one request + one cache entry keyed by workflowKeys.state(id): the store hydrates it via fetchQuery({ staleTime: 0 }) (preserving always-refetch, incl. the socket refresh path) and the hooks derive the mapped WorkflowState via select. Granular error boundaries — add error.tsx to the logs, knowledge, and files panels so a crash scopes to the panel instead of the whole workspace shell (reuses the shared ErrorState). Unsubscribe page → React Query — replace 5 useState + effect + inline fetch with useUnsubscribe query + useUnsubscribeMutation; contract change is additive (named type aliases only). Type of Change Improvement / refactor Testing Added 16 targeted tests (all passing, Biome-clean): session upgrade-path ordering (fresh wins over a late stale mount query — mutation-verified the cancelQueries guard), workflow-state cache collapse (single shared entry, always-refetch, request-id staleness guard), unsubscribe query gating + mutation cache reconcile, and the logs error boundary (first ErrorState coverage). tsc 0 errors, bun run lint, check:react-query, check:api-validation all green. Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing No new warnings introduced I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Open Graph Description: Summary SessionProvider → React Query — replace the hand-rolled useState/useEffect/loadSession with a useSessionQuery() hook. Context shape is byte-identical ({ data, isPending, error, refetch }) ...

X Description: Summary SessionProvider → React Query — replace the hand-rolled useState/useEffect/loadSession with a useSessionQuery() hook. Context shape is byte-identical ({ data, isPending, error, refetch }) ...

Opengraph URL: https://github.com/simstudioai/sim/pull/5168

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:167c85bc-cb8e-1bd4-d483-aaeb6de0c0b4
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idB138:327CBE:6700D0:9269CF:6AFB461E
html-safe-nonce7c189843544346e38d42a2d1b98460e6a18547fa6794c96a1f7aabd341a1e991
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMTM4OjMyN0NCRTo2NzAwRDA6OTI2OUNGOjZBRkI0NjFFIiwidmlzaXRvcl9pZCI6IjMwODg5MTc2OTA5NTUzODIwNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmaca5cb4e4a94a97465c93c87aa2ee0dd5b2649f77d4b2dfcb930ccd9f35e8264a8
hovercard-subject-tagpull_request:3914551667
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/5168/files
twitter:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
og:image:altSummary SessionProvider → React Query — replace the hand-rolled useState/useEffect/loadSession with a useSessionQuery() hook. Context shape is byte-identical ({ data, isPending, error, refetch }) ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noned849b928f455c800985398e7f1b659425adb312a5fa14fba5d9a14e62e9fe5dd
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/simstudioai/sim git https://github.com/simstudioai/sim.git
octolytics-dimension-user_id199344406
octolytics-dimension-user_loginsimstudioai
octolytics-dimension-repository_id912559512
octolytics-dimension-repository_nwosimstudioai/sim
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id912559512
octolytics-dimension-repository_network_root_nwosimstudioai/sim
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasea6c2f87cbcb6414452377b4967858ed6a66f1109
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/5168/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F5168%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F5168%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=simstudioai%2Fsim
Reloadhttps://github.com/simstudioai/sim/pull/5168/files
Reloadhttps://github.com/simstudioai/sim/pull/5168/files
Reloadhttps://github.com/simstudioai/sim/pull/5168/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests199 (199)https://github.com/simstudioai/sim/pulls
Actionshttps://github.com/simstudioai/sim/actions
Projectshttps://github.com/simstudioai/sim/projects
Security and qualityhttps://github.com/simstudioai/sim/security
Insightshttps://github.com/simstudioai/sim/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
waleedlatif1https://github.com/waleedlatif1
staginghttps://github.com/simstudioai/sim/tree/staging
chore/frontend-arch-cleanuphttps://github.com/simstudioai/sim/tree/chore/frontend-arch-cleanup
Conversation 23 https://github.com/simstudioai/sim/pull/5168
Commits 7 https://github.com/simstudioai/sim/pull/5168/commits
Checks 15 https://github.com/simstudioai/sim/pull/5168/checks
Files changed https://github.com/simstudioai/sim/pull/5168/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5168/files
refactor(frontend-arch): migrate server state to React Query, collapse duplicate workflow-state cache, granular error boundaries https://github.com/simstudioai/sim/pull/5168/files#top
Show all changes 7 commits https://github.com/simstudioai/sim/pull/5168/files
80fcb0e refactor(session): migrate SessionProvider to React Query useSessionQ… waleedlatif1 Jun 22, 2026 https://github.com/simstudioai/sim/pull/5168/commits/80fcb0e95fe16c30919bcf2f0acc58e81386dc3a
3a143bc refactor(workflows): collapse duplicate workflow-state cache waleedlatif1 Jun 22, 2026 https://github.com/simstudioai/sim/pull/5168/commits/3a143bcf11882c00e08ab583a6fafff78b84a390
edb2fe8 fix(workspace): add granular error boundaries to logs, knowledge, and… waleedlatif1 Jun 22, 2026 https://github.com/simstudioai/sim/pull/5168/commits/edb2fe83178f1773016a55b7ef56cf56146b83b3
03f7d8c refactor(unsubscribe): migrate page to React Query waleedlatif1 Jun 22, 2026 https://github.com/simstudioai/sim/pull/5168/commits/03f7d8c927b0d2ae31f153044b3f8cc9452b9fc4
650db2d test(frontend-arch): cover session race fix, workflow-state cache col… waleedlatif1 Jun 22, 2026 https://github.com/simstudioai/sim/pull/5168/commits/650db2d3a38665268afb1f66730b30bbd975bbba
9ccde3a fix(session): harden upgrade path + address review feedback waleedlatif1 Jun 22, 2026 https://github.com/simstudioai/sim/pull/5168/commits/9ccde3a64c366872654d4f728b77299f8fddc8a2
7c92041 refactor(session): break provider<->hook type cycle, fail-fast sessio… waleedlatif1 Jun 22, 2026 https://github.com/simstudioai/sim/pull/5168/commits/7c920419621ec0208bdaf28853140a3437600963
Clear filters https://github.com/simstudioai/sim/pull/5168/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5168/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5168/files
session-provider.test.tsx https://github.com/simstudioai/sim/pull/5168/files#diff-eac96639d6e39f19ef8bc73771c8a01fb2cfbaf04026c41e771b17c60bac7bf7
session-provider.tsx https://github.com/simstudioai/sim/pull/5168/files#diff-1d8a85d8920e3d24bebdd4998424a17cf786d249f99dd835bfea6f893dd311b5
unsubscribe.tsx https://github.com/simstudioai/sim/pull/5168/files#diff-a875236a1aedf80783a94b6e30a6defac387b3da989cb00934e2360ca064d08d
error.tsx https://github.com/simstudioai/sim/pull/5168/files#diff-f94c37653af372fcc3c0e958a12adb39e0419783655b0fb44a4ccfbf92784e48
error.tsx https://github.com/simstudioai/sim/pull/5168/files#diff-3148b2c7e038c2945ae652b5fedb41625032b8e0c9365cebb60b084eb63b7c99
error.test.tsx https://github.com/simstudioai/sim/pull/5168/files#diff-15f71c7323a41b491135993d487af824c5e46c15e66e88a73ac599a8096c15a3
error.tsx https://github.com/simstudioai/sim/pull/5168/files#diff-c593499f8b914d492bef353d768c6b6e5c5ef02e63ddcf123c008d2bc1b2fdef
session.ts https://github.com/simstudioai/sim/pull/5168/files#diff-7af5da8da0acc5d808e339662832652a9837c642ee0107621c81f46d5bac8f27
unsubscribe.test.tsx https://github.com/simstudioai/sim/pull/5168/files#diff-c61e669acd1acd7ec1f5c18fa7eab201af49efe1287191a82a254b963480e2c9
unsubscribe.ts https://github.com/simstudioai/sim/pull/5168/files#diff-a148ee211eccb0004a71e26de89d1117105c491cab85d82bcfc1edb469148d9a
fetch-workflow-envelope.test.ts https://github.com/simstudioai/sim/pull/5168/files#diff-64a8d30d34ad987107426c68a9132f8e8be81ebfee497527b6a176736208984f
fetch-workflow-envelope.ts https://github.com/simstudioai/sim/pull/5168/files#diff-7253435d41c7924eb45af18f0d7d3ff47c93279a322259649e567bdede40b3ba
workflows.ts https://github.com/simstudioai/sim/pull/5168/files#diff-0ed3b1c75a5e5cad10d38bbb4baba66c1baf265d534310cd198ff4644dcab388
user.ts https://github.com/simstudioai/sim/pull/5168/files#diff-095f7a2d1473a6ce47da4b69d1c8ded6cf538a9c9a9f8d2957dc5539d16b827c
session-response.ts https://github.com/simstudioai/sim/pull/5168/files#diff-2ee1d1519bfb8d296cb3f5c98c32a033028761b57d8dc2bc997bb07d43cae89a
store.test.ts https://github.com/simstudioai/sim/pull/5168/files#diff-07a492bc47220e27b2ee359ab8689d765fbf81cbb567e3acd3e7e0ce3b9ffd72
store.ts https://github.com/simstudioai/sim/pull/5168/files#diff-67b03315386e5c1ff1d14188d5f0a15f98ddf34212b828412e9b6c7545b24510
apps/sim/app/_shell/providers/session-provider.test.tsxhttps://github.com/simstudioai/sim/pull/5168/files#diff-eac96639d6e39f19ef8bc73771c8a01fb2cfbaf04026c41e771b17c60bac7bf7
View file https://github.com/simstudioai/sim/blob/7c920419621ec0208bdaf28853140a3437600963/apps/sim/app/_shell/providers/session-provider.test.tsx
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5168/{{ revealButtonHref }}
Please reload this pagehttps://github.com/simstudioai/sim/pull/5168/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5168/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.