René's URL Explorer Experiment


Title: improvement(chat): defer resource-menu list queries until the menu opens by waleedlatif1 · Pull Request #5973 · simstudioai/sim · GitHub

Open Graph Title: improvement(chat): defer resource-menu list queries until the menu opens by waleedlatif1 · Pull Request #5973 · simstudioai/sim

X Title: improvement(chat): defer resource-menu list queries until the menu opens by waleedlatif1 · Pull Request #5973 · simstudioai/sim

Description: Summary The + resource menu and the @-mention menu both hydrate from useAvailableResources, which fired nine workspace-wide list queries and rebuilt ten item groups on mount — from two always-mounted call sites, for menus that were closed. Now gated on each menu's own state. Added options.enabled to the six query hooks that lacked it, matching the convention already used by useWorkspaceFiles / useKnowledgeBasesQuery / useLogsList. The tab-name lookup no longer fires its five list queries when there are no tabs to label. Dropped the = [] destructuring defaults in the aggregator — a literal default allocates a fresh array every render while data is undefined, which busted the group memo in exactly the disabled state. Disabled now returns a module-scope constant, so the four downstream memos stay stable too. Moved the hook call into PlusMenuDropdown (the component that owns the open state), removing the availableResources pass-through from usePromptEditor → PromptEditor. This also restores the React.memo boundary on PlusMenuDropdown, which the array prop was defeating on every keystroke. Deleted the existingKeys/isOpen plumbing threaded through AvailableItem, both tree-node unions and both onSelect signatures — PlusMenuDropdown never read it. Resolved at the single call site instead. Not losing mentions while the lists load Deferring the lists introduced a window where the mention candidates were empty. That mattered more than it first looked: selectActive() returning falsy makes the keydown handler fall through and submit the message, with the mention left as raw text. Closed in two steps: Warm on focus — PlusMenuDropdown gates on open || warm, and PromptEditor latches warm on the textarea's first focus. Focus is the earliest reliable signal a mention may be coming, so the lists are in flight well before anyone can type @, while still staying off the page-load path. Make readiness explicit — warming shrinks the race but doesn't guarantee readiness, so useAvailableResources now reports isHydrating and PlusMenuHandle.selectActive returns selected | empty | hydrating. Tab/Enter are swallowed while hydrating and only fall through once the lists have settled, where an empty result is a genuine no-match. isHydrating keys off isPending rather than data === undefined, so a failed list settles instead of blocking the key forever. Found while investigating a customer report of slow chat loading. Worth being clear about scope: this is a real reduction in work per chat load, but it is not the fix for that report. The dominant costs there are the embedded workflow editor mounting inside the chat, the block/tool registry in the route's initial bundle, and a ~294 KB transcript — all separate follow-ups. Type of Change Improvement Testing Tested manually. Typecheck clean, bun run lint:check 19/19, 249 home tests pass, check:react-query / check:api-validation / check:client-boundary all 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)

Open Graph Description: Summary The + resource menu and the @-mention menu both hydrate from useAvailableResources, which fired nine workspace-wide list queries and rebuilt ten item groups on mount — from two always-moun...

X Description: Summary The + resource menu and the @-mention menu both hydrate from useAvailableResources, which fired nine workspace-wide list queries and rebuilt ten item groups on mount — from two always-moun...

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

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:4ddc6f0b-5f33-fa4d-a5c8-9fa104859b5e
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idE1F4:1D33A1:A0389B:DC65B4:6AFB4DD2
html-safe-noncea8717af44e729b2a245e6a3bb691b2b4e46841366197c9880204b6397480faad
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMUY0OjFEMzNBMTpBMDM4OUI6REM2NUI0OjZBRkI0REQyIiwidmlzaXRvcl9pZCI6IjE1MDYwODIwNTk5NjgwMDc2MzQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac43df1b6033ca6c6aacbab36c8152f9be8089cbf7570ae9dc4a7f7f24a4e772bc
hovercard-subject-tagpull_request:4144268305
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/5973/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 The + resource menu and the @-mention menu both hydrate from useAvailableResources, which fired nine workspace-wide list queries and rebuilt ten item groups on mount — from two always-moun...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneacf7616d06cc051644705b379878c9bb13dc5e70ecf4ffd9b34140f8ac01d7e1
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
release26504db649b58525278f77a52b80ba5f10d5f4de
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/5973/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F5973%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%2F5973%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/5973/files
Reloadhttps://github.com/simstudioai/sim/pull/5973/files
Reloadhttps://github.com/simstudioai/sim/pull/5973/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/large-chat-loadinghttps://github.com/simstudioai/sim/tree/fix/large-chat-loading
Conversation 14 https://github.com/simstudioai/sim/pull/5973
Commits 3 https://github.com/simstudioai/sim/pull/5973/commits
Checks 20 https://github.com/simstudioai/sim/pull/5973/checks
Files changed https://github.com/simstudioai/sim/pull/5973/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5973/files
improvement(chat): defer resource-menu list queries until the menu opens https://github.com/simstudioai/sim/pull/5973/files#top
Show all changes 3 commits https://github.com/simstudioai/sim/pull/5973/files
d66b103 improvement(chat): defer resource-menu list queries until the menu opens waleedlatif1 Jul 27, 2026 https://github.com/simstudioai/sim/pull/5973/commits/d66b103d6d87acc09337a25742b1641cc46b4b40
8f224ce fix(chat): warm resource lists on editor focus so fast mentions resolve waleedlatif1 Jul 27, 2026 https://github.com/simstudioai/sim/pull/5973/commits/8f224ce0b32e8f8371fa6dea7ae0809d77e32c04
6a44068 fix(chat): never submit a mention while its candidate lists are loading waleedlatif1 Jul 27, 2026 https://github.com/simstudioai/sim/pull/5973/commits/6a44068e4802e7f302d11edeb92f37cfe65337b7
Clear filters https://github.com/simstudioai/sim/pull/5973/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5973/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5973/files
add-resource-dropdown.tsx https://github.com/simstudioai/sim/pull/5973/files#diff-ea316da40c4381b5519cdfa45bd9cb2295d8cb8c20b24b745a7d0b72efdbde98
index.ts https://github.com/simstudioai/sim/pull/5973/files#diff-b576a10789f82c9b0b47decd8c0df311af606a7186a5663f2b80b90a66d10a4b
index.ts https://github.com/simstudioai/sim/pull/5973/files#diff-0c6f85a0e893231c45071c53830559cde0af5bb504893e23c7c0327c19e1a19a
resource-tabs.tsx https://github.com/simstudioai/sim/pull/5973/files#diff-3100bbc514f6d0cde18752fc6c6fc7a201c93cee56d5ac3733f477f04144cfbc
constants.ts https://github.com/simstudioai/sim/pull/5973/files#diff-722ba9dd9456aa1a476572d6129783a59a5a3c7880b6094d8233054202603952
index.ts https://github.com/simstudioai/sim/pull/5973/files#diff-bb4697c2b8c5121abc23cc3a103b0120cf7f487ecc58f80788e6017d4b2f389a
index.ts https://github.com/simstudioai/sim/pull/5973/files#diff-6f1fe7b25e9caea3fc81d54ccfe6cc4264679a4f7aa43bdf767a5c341172ba50
plus-menu-dropdown.tsx https://github.com/simstudioai/sim/pull/5973/files#diff-7f3521b4b49198b62a96c08b37dafaf54eb9cd3639580ba23757e383ebc1a764
prompt-editor.tsx https://github.com/simstudioai/sim/pull/5973/files#diff-4fa9ac5df8aff640cea0204b06b4e35e7dc0946a8422ce8e11d9865f08fab42a
use-prompt-editor.test.tsx https://github.com/simstudioai/sim/pull/5973/files#diff-a8f1083a14a5b4e5aa24a64348b073e05f8da872c3cd3edcc8bbe88866412bd6
use-prompt-editor.ts https://github.com/simstudioai/sim/pull/5973/files#diff-8a5cf89c13010b7c70471f1314d499c25d224a4e9db7a66fff1e6ddff97b9704
folders.ts https://github.com/simstudioai/sim/pull/5973/files#diff-fcd03a08650b2640b95989818e3e89e886aa743ccf2921d90ffd3ec1a689f1b1
mothership-chats.ts https://github.com/simstudioai/sim/pull/5973/files#diff-d93326dc7ad3c0d6856933a9ba910634ba50d1e7c3292f43f7aaa85ca2979311
schedules.ts https://github.com/simstudioai/sim/pull/5973/files#diff-862dcb8380416a74c880fe8d458490c8149bb76291e9cea21dfa547038e9fe4e
tables.ts https://github.com/simstudioai/sim/pull/5973/files#diff-1d761ed5a7a2ed9ba4435d0f39c5f1f7ac13c177b301c401b38f5a6d731ac8cb
workflows.ts https://github.com/simstudioai/sim/pull/5973/files#diff-0ed3b1c75a5e5cad10d38bbb4baba66c1baf265d534310cd198ff4644dcab388
workspace-file-folders.ts https://github.com/simstudioai/sim/pull/5973/files#diff-7f919b42006635de731f24e6cc0cbff144fc0d0dd583db6010e20006d742099b
...ome/components/mothership-view/components/add-resource-dropdown/add-resource-dropdown.tsxhttps://github.com/simstudioai/sim/pull/5973/files#diff-ea316da40c4381b5519cdfa45bd9cb2295d8cb8c20b24b745a7d0b72efdbde98
View file https://github.com/simstudioai/sim/blob/6a44068e4802e7f302d11edeb92f37cfe65337b7/apps/sim/app/workspace/%5BworkspaceId%5D/home/components/mothership-view/components/add-resource-dropdown/add-resource-dropdown.tsx
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5973/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/5973/files#diff-ea316da40c4381b5519cdfa45bd9cb2295d8cb8c20b24b745a7d0b72efdbde98
https://github.com/simstudioai/sim/pull/5973/files#diff-ea316da40c4381b5519cdfa45bd9cb2295d8cb8c20b24b745a7d0b72efdbde98
https://github.com/simstudioai/sim/pull/5973/files#diff-ea316da40c4381b5519cdfa45bd9cb2295d8cb8c20b24b745a7d0b72efdbde98
https://github.com/simstudioai/sim/pull/5973/files#diff-ea316da40c4381b5519cdfa45bd9cb2295d8cb8c20b24b745a7d0b72efdbde98
https://github.com/simstudioai/sim/pull/5973/files#diff-ea316da40c4381b5519cdfa45bd9cb2295d8cb8c20b24b745a7d0b72efdbde98
https://github.com/simstudioai/sim/pull/5973/files#diff-ea316da40c4381b5519cdfa45bd9cb2295d8cb8c20b24b745a7d0b72efdbde98
https://github.com/simstudioai/sim/pull/5973/files#diff-ea316da40c4381b5519cdfa45bd9cb2295d8cb8c20b24b745a7d0b72efdbde98
https://github.com/simstudioai/sim/pull/5973/files#diff-ea316da40c4381b5519cdfa45bd9cb2295d8cb8c20b24b745a7d0b72efdbde98
https://github.com/simstudioai/sim/pull/5973/files#diff-ea316da40c4381b5519cdfa45bd9cb2295d8cb8c20b24b745a7d0b72efdbde98
https://github.com/simstudioai/sim/pull/5973/files#diff-ea316da40c4381b5519cdfa45bd9cb2295d8cb8c20b24b745a7d0b72efdbde98
https://github.com/simstudioai/sim/pull/5973/files#diff-ea316da40c4381b5519cdfa45bd9cb2295d8cb8c20b24b745a7d0b72efdbde98
https://github.com/simstudioai/sim/pull/5973/files#diff-ea316da40c4381b5519cdfa45bd9cb2295d8cb8c20b24b745a7d0b72efdbde98
https://github.com/simstudioai/sim/pull/5973/files#diff-ea316da40c4381b5519cdfa45bd9cb2295d8cb8c20b24b745a7d0b72efdbde98
https://github.com/simstudioai/sim/pull/5973/files#diff-ea316da40c4381b5519cdfa45bd9cb2295d8cb8c20b24b745a7d0b72efdbde98
https://github.com/simstudioai/sim/pull/5973/files#diff-ea316da40c4381b5519cdfa45bd9cb2295d8cb8c20b24b745a7d0b72efdbde98
https://github.com/simstudioai/sim/pull/5973/files#diff-ea316da40c4381b5519cdfa45bd9cb2295d8cb8c20b24b745a7d0b72efdbde98
https://github.com/simstudioai/sim/pull/5973/files#diff-ea316da40c4381b5519cdfa45bd9cb2295d8cb8c20b24b745a7d0b72efdbde98
https://github.com/simstudioai/sim/pull/5973/files#diff-ea316da40c4381b5519cdfa45bd9cb2295d8cb8c20b24b745a7d0b72efdbde98
https://github.com/simstudioai/sim/pull/5973/files#diff-ea316da40c4381b5519cdfa45bd9cb2295d8cb8c20b24b745a7d0b72efdbde98
https://github.com/simstudioai/sim/pull/5973/files#diff-ea316da40c4381b5519cdfa45bd9cb2295d8cb8c20b24b745a7d0b72efdbde98
https://github.com/simstudioai/sim/pull/5973/files#diff-ea316da40c4381b5519cdfa45bd9cb2295d8cb8c20b24b745a7d0b72efdbde98
https://github.com/simstudioai/sim/pull/5973/files#diff-ea316da40c4381b5519cdfa45bd9cb2295d8cb8c20b24b745a7d0b72efdbde98
Please reload this pagehttps://github.com/simstudioai/sim/pull/5973/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5973/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.