René's URL Explorer Experiment


Title: fix(workspaces): persist visit recency server-side so sidebar order is stable on refresh by waleedlatif1 · Pull Request #8284 · simstudioai/sim · GitHub

Open Graph Title: fix(workspaces): persist visit recency server-side so sidebar order is stable on refresh by waleedlatif1 · Pull Request #8284 · simstudioai/sim

X Title: fix(workspaces): persist visit recency server-side so sidebar order is stable on refresh by waleedlatif1 · Pull Request #8284 · simstudioai/sim

Description: Summary Workspace visit order lived only in localStorage, so the server rendered the sidebar newest-first and the client re-sorted after hydration — non-pinned workspaces reshuffled on every refresh (pins were already server-side, so they stayed put) New workspace_visit table (one row per user + workspace, last visit time); POST /api/workspaces/[id]/visit records a visit through a session-only workspaces.visits.record operation, replacing the settings write the sidebar made on every visit Visits are stamped with the database clock and sent one at a time (mutation scope), so rapid switching always leaves the last-opened workspace newest GET /api/workspaces returns workspaces most recently visited first (then newest first) and derives lastActiveWorkspaceId from the latest visit, falling back to the legacy settings column Sidebar switcher and org sidebar read one order from the list query (pins lifted to the top in a select), so server render and hydration always agree and the order follows the user across devices Visiting moves the workspace to the front of the cached list immediately; the list reconciles after the last queued visit settles Removed WorkspaceRecencyStorage and useWorkspaceOrder Anything taking workspaces[0] (the /workspace redirect fallback, orphaned-workflow repair) now gets the most recently visited workspace instead of the newest Follow-up (after this is fully deployed): drop settings.last_active_workspace_id and its settings API fields, once the settings full-row inserts exclude it. Type of Change Bug fix Testing Hydration test asserts server render matches the final order and hydration changes zero DOM nodes Unit tests for the visit use case (role, principal kinds, concealment, not found), route (401/200/404 parity), repository, ordering, and the visit mutation (optimistic reorder, serialization, last-settle reconcile) lint, type-check, check:audits (49), check:api-validation:strict, check:migrations, docs-manifest:check pass 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) 🤖 Generated with Claude Code

Open Graph Description: Summary Workspace visit order lived only in localStorage, so the server rendered the sidebar newest-first and the client re-sorted after hydration — non-pinned workspaces reshuffled on every refre...

X Description: Summary Workspace visit order lived only in localStorage, so the server rendered the sidebar newest-first and the client re-sorted after hydration — non-pinned workspaces reshuffled on every refre...

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

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:22abfb8e-753e-39bc-81da-2bfe96370e0b
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idCEE6:15FC93:68805D:92631B:6AFB64C3
html-safe-noncef4f50640043ed60f24eb74edb652b1be4266742318a5fa43c7589f36e47c4098
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRUU2OjE1RkM5Mzo2ODgwNUQ6OTI2MzFCOjZBRkI2NEMzIiwidmlzaXRvcl9pZCI6Ijc3NzYzOTQxMDM0NzM1MzAwNTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac15731e1250c417c26d345b60af3e456c1146b5b94485fc665643cd6ee3dced56
hovercard-subject-tagpull_request:4632728963
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/8284/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 Workspace visit order lived only in localStorage, so the server rendered the sidebar newest-first and the client re-sorted after hydration — non-pinned workspaces reshuffled on every refre...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneea33d13c96d0ff66bd8fa906b193d2213536b78cb06b0c50a4632c58b1418f94
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
release59ef97164c52cf59bd10558ddec9c4f482763988
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/8284/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F8284%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%2F8284%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/8284/files
Reloadhttps://github.com/simstudioai/sim/pull/8284/files
Reloadhttps://github.com/simstudioai/sim/pull/8284/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests197 (197)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
fix/sidebar-workspace-order-flashhttps://github.com/simstudioai/sim/tree/fix/sidebar-workspace-order-flash
Conversation 33 https://github.com/simstudioai/sim/pull/8284
Commits 5 https://github.com/simstudioai/sim/pull/8284/commits
Checks 33 https://github.com/simstudioai/sim/pull/8284/checks
Files changed https://github.com/simstudioai/sim/pull/8284/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8284/files
fix(workspaces): persist visit recency server-side so sidebar order is stable on refresh https://github.com/simstudioai/sim/pull/8284/files#top
Show all changes 5 commits https://github.com/simstudioai/sim/pull/8284/files
69d3bba fix(workspaces): persist visit recency server-side so sidebar order i… waleedlatif1 Sep 25, 2026 https://github.com/simstudioai/sim/pull/8284/commits/69d3bba04b372ee4941ff19591cbf54e22f8c539
bf2c905 fix(workspaces): serialize visits and stamp them with the database clock waleedlatif1 Sep 25, 2026 https://github.com/simstudioai/sim/pull/8284/commits/bf2c9056a5e8753382683271946b88f68dcc5084
64a71eb chore(workspaces): drop leftover churn and mark the legacy last-activ… waleedlatif1 Sep 25, 2026 https://github.com/simstudioai/sim/pull/8284/commits/64a71eb96ba6540470b4b966ed67ffe30091664a
6a48a0d chore(db): drop contract marker on settings.last_active_workspace_id waleedlatif1 Sep 25, 2026 https://github.com/simstudioai/sim/pull/8284/commits/6a48a0d02a0ddb732fdfc90dd8e8c21cd5b2c433
42fad40 chore(workspaces): write the permission-group exemption as TSDoc waleedlatif1 Sep 25, 2026 https://github.com/simstudioai/sim/pull/8284/commits/42fad40521941289bc5c4d37daa5fe4b737d452b
Clear filters https://github.com/simstudioai/sim/pull/8284/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8284/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8284/files
route.test.ts https://github.com/simstudioai/sim/pull/8284/files#diff-fdca2a5ab7c394125fd35e0c4c517f0dbdb4369d4eefbb0600473864204c78f9
route.ts https://github.com/simstudioai/sim/pull/8284/files#diff-caba6f26024a1e402d94844a69a01240ccd17a50396dad7add415febe82928b0
use-organization-workspaces.test.tsx https://github.com/simstudioai/sim/pull/8284/files#diff-3abe93244a2ca619bdc6357093eed232415b925c2d8c10e8d92aa2f6ed2c99d4
use-organization-workspaces.ts https://github.com/simstudioai/sim/pull/8284/files#diff-dd3305e18d58014e297ff63bee826dd25ea2049c7845bf2186bef140df9dc866
use-workspace-management.test.tsx https://github.com/simstudioai/sim/pull/8284/files#diff-020321a3f3a35e461b35969ccee89037fa8eb98ac6be89baaeb19852d6cee1cb
use-workspace-management.ts https://github.com/simstudioai/sim/pull/8284/files#diff-29156026383a112bc0c002e56d90a3ff9c810481c420182f105e37606354c6f8
page.test.tsx https://github.com/simstudioai/sim/pull/8284/files#diff-b41f95dd33612a476c4792583653d740cac545f400d8d58b8aa16fc7c47660d0
page.tsx https://github.com/simstudioai/sim/pull/8284/files#diff-f42c59dc612d9c5f8151ebc35e0b368a68007747ef70aae964f65d7e50da7ef4
workspace.test.tsx https://github.com/simstudioai/sim/pull/8284/files#diff-47aba44fff2d5e956205ac0909e7946649dc9a3b316c2f9241f00f76dbd556bc
workspace.ts https://github.com/simstudioai/sim/pull/8284/files#diff-9ff80a6ef369fe0add93169866397acd992f4db9c6f780a3eadc5e5306c38535
use-workspace-order.ts https://github.com/simstudioai/sim/pull/8284/files#diff-cd65760d3906979244fcaee1a85a3129de7cc9e7a16c4fcc3ae8b6e44f73fa82
workspaces.ts https://github.com/simstudioai/sim/pull/8284/files#diff-cc809bb2a9762a5e34aa3dead6e253dc3a338a8015828af9cbc7a24bd40c8e1d
browser-storage.ts https://github.com/simstudioai/sim/pull/8284/files#diff-32aeb777aa84abec058370c350ef61e17af04b4ad37244ce193e02cf076e0e6a
route-policies.ts https://github.com/simstudioai/sim/pull/8284/files#diff-36d0f6ca12a7a86c4a604795c83d601c0f064386703383b3b8e14505685a0d6b
record-workspace-visit.test.ts https://github.com/simstudioai/sim/pull/8284/files#diff-fc10ba32537d523e0b3f7bb12c723a1bb3fe702ddc09fa9e3858a9af40a67daa
record-workspace-visit.ts https://github.com/simstudioai/sim/pull/8284/files#diff-498d52817bc8f6a3198a1202fefacbffd13bff0385e3c69dd35460def50216d9
list.ts https://github.com/simstudioai/sim/pull/8284/files#diff-027ca4d5cd768b6aad891bad61b00eafd1a6a29b4d9c62774f7ce25c27e8fd8c
visits.test.ts https://github.com/simstudioai/sim/pull/8284/files#diff-266ce5d410a7be5900e2cd07210492422341afbea1b16f040b646acffc1087d9
visits.ts https://github.com/simstudioai/sim/pull/8284/files#diff-df54dd1ce6bc44ed5dec8b546293f7fa971baae315841f19190447920f0ccd48
0383_workspace_visit.sql https://github.com/simstudioai/sim/pull/8284/files#diff-7d32a8946538ac6c80378604372f3965248f7037b321e63687da9aee750ee552
0383_snapshot.json https://github.com/simstudioai/sim/pull/8284/files#diff-af08f89a41679ce136d5d71df8c77e87274cd2d2d150dbb1d5d334b6d7e1f6d5
_journal.json https://github.com/simstudioai/sim/pull/8284/files#diff-37150cc65ad16ee6fbc5fa318fc096be7730e16d63eaf863e3df5521b7030649
schema.ts https://github.com/simstudioai/sim/pull/8284/files#diff-9a959e2ce3cb4c86957bbae021d06eae364f7b0cb18964f5873bab53220af928
schema.mock.ts https://github.com/simstudioai/sim/pull/8284/files#diff-3b648ee44a059e5fc069169fdfd7c32c89200a3e79b5d0dc25227d3470da73af
apps/sim/app/api/workspaces/[id]/visit/route.test.tshttps://github.com/simstudioai/sim/pull/8284/files#diff-fdca2a5ab7c394125fd35e0c4c517f0dbdb4369d4eefbb0600473864204c78f9
View file https://github.com/simstudioai/sim/blob/42fad40521941289bc5c4d37daa5fe4b737d452b/apps/sim/app/api/workspaces/%5Bid%5D/visit/route.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8284/{{ revealButtonHref }}
apps/sim/app/api/workspaces/[id]/visit/route.tshttps://github.com/simstudioai/sim/pull/8284/files#diff-caba6f26024a1e402d94844a69a01240ccd17a50396dad7add415febe82928b0
View file https://github.com/simstudioai/sim/blob/42fad40521941289bc5c4d37daa5fe4b737d452b/apps/sim/app/api/workspaces/%5Bid%5D/visit/route.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8284/{{ revealButtonHref }}
...rganizationId]/components/organization-sidebar/hooks/use-organization-workspaces.test.tsxhttps://github.com/simstudioai/sim/pull/8284/files#diff-3abe93244a2ca619bdc6357093eed232415b925c2d8c10e8d92aa2f6ed2c99d4
View file https://github.com/simstudioai/sim/blob/42fad40521941289bc5c4d37daa5fe4b737d452b/apps/sim/app/o/%5BorganizationId%5D/components/organization-sidebar/hooks/use-organization-workspaces.test.tsx
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8284/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8284/files#diff-3abe93244a2ca619bdc6357093eed232415b925c2d8c10e8d92aa2f6ed2c99d4
https://github.com/simstudioai/sim/pull/8284/files#diff-3abe93244a2ca619bdc6357093eed232415b925c2d8c10e8d92aa2f6ed2c99d4
https://github.com/simstudioai/sim/pull/8284/files#diff-3abe93244a2ca619bdc6357093eed232415b925c2d8c10e8d92aa2f6ed2c99d4
...p/o/[organizationId]/components/organization-sidebar/hooks/use-organization-workspaces.tshttps://github.com/simstudioai/sim/pull/8284/files#diff-dd3305e18d58014e297ff63bee826dd25ea2049c7845bf2186bef140df9dc866
View file https://github.com/simstudioai/sim/blob/42fad40521941289bc5c4d37daa5fe4b737d452b/apps/sim/app/o/%5BorganizationId%5D/components/organization-sidebar/hooks/use-organization-workspaces.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8284/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8284/files#diff-dd3305e18d58014e297ff63bee826dd25ea2049c7845bf2186bef140df9dc866
.../app/workspace/[workspaceId]/w/components/sidebar/hooks/use-workspace-management.test.tsxhttps://github.com/simstudioai/sim/pull/8284/files#diff-020321a3f3a35e461b35969ccee89037fa8eb98ac6be89baaeb19852d6cee1cb
View file https://github.com/simstudioai/sim/blob/42fad40521941289bc5c4d37daa5fe4b737d452b/apps/sim/app/workspace/%5BworkspaceId%5D/w/components/sidebar/hooks/use-workspace-management.test.tsx
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8284/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8284/files#diff-020321a3f3a35e461b35969ccee89037fa8eb98ac6be89baaeb19852d6cee1cb
https://github.com/simstudioai/sim/pull/8284/files#diff-020321a3f3a35e461b35969ccee89037fa8eb98ac6be89baaeb19852d6cee1cb
https://github.com/simstudioai/sim/pull/8284/files#diff-020321a3f3a35e461b35969ccee89037fa8eb98ac6be89baaeb19852d6cee1cb
https://github.com/simstudioai/sim/pull/8284/files#diff-020321a3f3a35e461b35969ccee89037fa8eb98ac6be89baaeb19852d6cee1cb
https://github.com/simstudioai/sim/pull/8284/files#diff-020321a3f3a35e461b35969ccee89037fa8eb98ac6be89baaeb19852d6cee1cb
https://github.com/simstudioai/sim/pull/8284/files#diff-020321a3f3a35e461b35969ccee89037fa8eb98ac6be89baaeb19852d6cee1cb
https://github.com/simstudioai/sim/pull/8284/files#diff-020321a3f3a35e461b35969ccee89037fa8eb98ac6be89baaeb19852d6cee1cb
https://github.com/simstudioai/sim/pull/8284/files#diff-020321a3f3a35e461b35969ccee89037fa8eb98ac6be89baaeb19852d6cee1cb
Please reload this pagehttps://github.com/simstudioai/sim/pull/8284/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8284/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.