René's URL Explorer Experiment


Title: fix(file-viewer): prevent scroll jump to top during Mothership streaming by waleedlatif1 · Pull Request #4559 · simstudioai/sim · GitHub

Open Graph Title: fix(file-viewer): prevent scroll jump to top during Mothership streaming by waleedlatif1 · Pull Request #4559 · simstudioai/sim

X Title: fix(file-viewer): prevent scroll jump to top during Mothership streaming by waleedlatif1 · Pull Request #4559 · simstudioai/sim

Description: Summary Fix root cause of scroll jump: MarkdownCheckboxCtx.Provider was conditionally rendered around the scroll container, causing it to unmount/remount (and reset scrollTop to 0) every time streaming started Add useScrollAnchor hook with a spacer element that inflates scrollHeight to prevent the browser from clamping scrollTop when streamed content temporarily shrinks Linger activeSessionId on complete so streamingContent never becomes undefined between two consecutive Mothership tool calls on the same file Gate session activation in upsert on the incoming session having renderable content, preventing a blank flash when a new session starts before its first chunk arrives Fix shouldShowStreamingFilePanel to keep the panel mounted while the lingered session is active Fix use-chat post-write navigation condition to work with lingered completed sessions Fix useAutoScroll to check proximity before pinning to bottom on stream start (prevents unwanted jump-to-bottom in the chat panel) Type of Change Bug fix Testing Tested manually — scrolled to middle of a file, asked Mothership to make multi-step edits. Scroll position preserved across tool call boundaries. Also verified single patch, fresh write, and cross-file edits all behave correctly. Unit tests added: use-scroll-anchor.test.ts: 15 tests for computeSpacerShortage pure function use-file-preview-sessions.test.tsx: 7 new tests for linger, content-gate, and edge cases text-editor-state.test.ts: 5 new tests for inter-session content shrink scenario 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 Fix root cause of scroll jump: MarkdownCheckboxCtx.Provider was conditionally rendered around the scroll container, causing it to unmount/remount (and reset scrollTop to 0) every time stre...

X Description: Summary Fix root cause of scroll jump: MarkdownCheckboxCtx.Provider was conditionally rendered around the scroll container, causing it to unmount/remount (and reset scrollTop to 0) every time stre...

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

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:04d36499-cb46-f5b4-68d3-3f82c67ec189
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id87C0:1C8E04:DA415A:12BDA9F:6AFB5D85
html-safe-noncec3925d719a00e4be55e48afeec9736c2db39ce60a3517ab48ce335119fa39ca9
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4N0MwOjFDOEUwNDpEQTQxNUE6MTJCREE5Rjo2QUZCNUQ4NSIsInZpc2l0b3JfaWQiOiIyNTU5NzgyNDQ0NTUyMjY3NTciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacb30532bcddd05b762616fc9593e5e071d63809dcaa25735af8582fcffad01211
hovercard-subject-tagpull_request:3665090858
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/4559/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 Fix root cause of scroll jump: MarkdownCheckboxCtx.Provider was conditionally rendered around the scroll container, causing it to unmount/remount (and reset scrollTop to 0) every time stre...
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/4559/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F4559%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%2F4559%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/4559/files
Reloadhttps://github.com/simstudioai/sim/pull/4559/files
Reloadhttps://github.com/simstudioai/sim/pull/4559/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/filhttps://github.com/simstudioai/sim/tree/fix/fil
Conversation 17 https://github.com/simstudioai/sim/pull/4559
Commits 9 https://github.com/simstudioai/sim/pull/4559/commits
Checks 12 https://github.com/simstudioai/sim/pull/4559/checks
Files changed https://github.com/simstudioai/sim/pull/4559/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/4559/files
fix(file-viewer): prevent scroll jump to top during Mothership streaming https://github.com/simstudioai/sim/pull/4559/files#top
Show all changes 9 commits https://github.com/simstudioai/sim/pull/4559/files
db84d87 fix(file-viewer): prevent scroll jump to top during Mothership streaming waleedlatif1 May 11, 2026 https://github.com/simstudioai/sim/pull/4559/commits/db84d87e88e70643df98c8d5c523c6952a190f2b
f021927 fix(file-viewer): preserve session linger in hydrate/upsert and clear… waleedlatif1 May 11, 2026 https://github.com/simstudioai/sim/pull/4559/commits/f021927396e050a7f1abc3bee5dda070f9192556
77f6364 chore(file-viewer): trim verbose comments to match codebase style waleedlatif1 May 11, 2026 https://github.com/simstudioai/sim/pull/4559/commits/77f63649a17722efee34f42bc95b82848998464e
3f6c813 fix(file-viewer): re-engage auto-scroll when user scrolls back to bottom waleedlatif1 May 11, 2026 https://github.com/simstudioai/sim/pull/4559/commits/3f6c8131ff3bd59be52622b32dfd0be9cbcfc0f3
62ecc74 chore(file-viewer): update scroll-anchor tsdoc, remove test separator… waleedlatif1 May 11, 2026 https://github.com/simstudioai/sim/pull/4559/commits/62ecc7469659ba0fdb8a2579a8958ab469ceeda4
3b99234 fix(file-viewer): prevent false re-engage when spacer restoration tri… waleedlatif1 May 12, 2026 https://github.com/simstudioai/sim/pull/4559/commits/3b9923469d5eb00fc3fad24bd6e003ed03919580
3683e68 refactor(file-viewer): extract shouldReengage as pure tested function waleedlatif1 May 12, 2026 https://github.com/simstudioai/sim/pull/4559/commits/3683e683e1698bfe4f017b875a1e0d6d59e6304e
791f76a chore(file-viewer): trim verbose inline comments in use-scroll-anchor waleedlatif1 May 12, 2026 https://github.com/simstudioai/sim/pull/4559/commits/791f76a4f3930102d5cb086123ceb12a996990a7
6b350d0 chore(file-viewer): final comment cleanup before merge waleedlatif1 May 12, 2026 https://github.com/simstudioai/sim/pull/4559/commits/6b350d063379b2ea8502a0061fa76a890faf8d30
Clear filters https://github.com/simstudioai/sim/pull/4559/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/4559/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/4559/files
preview-panel.tsx https://github.com/simstudioai/sim/pull/4559/files#diff-262acbff6b1806a04a00b077110f4a5ef817431fe8b5014d3553b7df8b202dd2
text-editor-state.test.ts https://github.com/simstudioai/sim/pull/4559/files#diff-b6afd6489d673e2fcdf072e7a48ea96413f3e791a60aadc0decfa66cbcd7a2b3
mothership-view.tsx https://github.com/simstudioai/sim/pull/4559/files#diff-db5280c2b2a6342e88c19859fa4e796b2cb8744c361e0249e1907e75e21b8ab0
use-chat.ts https://github.com/simstudioai/sim/pull/4559/files#diff-1a0584ccf9cc4bacd55ce19aeeea8d807c39f36c365fa5b6638587aad38c700d
use-file-preview-sessions.test.tsx https://github.com/simstudioai/sim/pull/4559/files#diff-154d4708f2872cc27833b84cc01a8c02aa5fa38873fc4663055c287dd18a4d2f
use-file-preview-sessions.ts https://github.com/simstudioai/sim/pull/4559/files#diff-7f7bad1490ee0f6b155331e6aa2fcb2486bf21300acbb93149a91451d98671ee
use-auto-scroll.ts https://github.com/simstudioai/sim/pull/4559/files#diff-1824d8c31587f935221be1a0db36a235b67247348747a168cc63fee348c13c34
use-scroll-anchor.test.ts https://github.com/simstudioai/sim/pull/4559/files#diff-968971928217021ab4bad817a01e813bb2942ae35866b35e6715e1b5bca7416c
use-scroll-anchor.ts https://github.com/simstudioai/sim/pull/4559/files#diff-b5245fa4206f7fe3b3ed1e35558e444441029157c487f978b774630ff710f854
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/preview-panel.tsxhttps://github.com/simstudioai/sim/pull/4559/files#diff-262acbff6b1806a04a00b077110f4a5ef817431fe8b5014d3553b7df8b202dd2
View file https://github.com/simstudioai/sim/blob/6b350d063379b2ea8502a0061fa76a890faf8d30/apps/sim/app/workspace/%5BworkspaceId%5D/files/components/file-viewer/preview-panel.tsx
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/4559/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/4559/files#diff-262acbff6b1806a04a00b077110f4a5ef817431fe8b5014d3553b7df8b202dd2
https://github.com/simstudioai/sim/pull/4559/files#diff-262acbff6b1806a04a00b077110f4a5ef817431fe8b5014d3553b7df8b202dd2
https://github.com/simstudioai/sim/pull/4559/files#diff-262acbff6b1806a04a00b077110f4a5ef817431fe8b5014d3553b7df8b202dd2
https://github.com/simstudioai/sim/pull/4559/files#diff-262acbff6b1806a04a00b077110f4a5ef817431fe8b5014d3553b7df8b202dd2
https://github.com/simstudioai/sim/pull/4559/files#diff-262acbff6b1806a04a00b077110f4a5ef817431fe8b5014d3553b7df8b202dd2
https://github.com/simstudioai/sim/pull/4559/files#diff-262acbff6b1806a04a00b077110f4a5ef817431fe8b5014d3553b7df8b202dd2
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/text-editor-state.test.tshttps://github.com/simstudioai/sim/pull/4559/files#diff-b6afd6489d673e2fcdf072e7a48ea96413f3e791a60aadc0decfa66cbcd7a2b3
View file https://github.com/simstudioai/sim/blob/6b350d063379b2ea8502a0061fa76a890faf8d30/apps/sim/app/workspace/%5BworkspaceId%5D/files/components/file-viewer/text-editor-state.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/4559/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/4559/files#diff-b6afd6489d673e2fcdf072e7a48ea96413f3e791a60aadc0decfa66cbcd7a2b3
apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/mothership-view.tsxhttps://github.com/simstudioai/sim/pull/4559/files#diff-db5280c2b2a6342e88c19859fa4e796b2cb8744c361e0249e1907e75e21b8ab0
View file https://github.com/simstudioai/sim/blob/6b350d063379b2ea8502a0061fa76a890faf8d30/apps/sim/app/workspace/%5BworkspaceId%5D/home/components/mothership-view/mothership-view.tsx
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/4559/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/4559/files#diff-db5280c2b2a6342e88c19859fa4e796b2cb8744c361e0249e1907e75e21b8ab0
https://github.com/simstudioai/sim/pull/4559/files#diff-db5280c2b2a6342e88c19859fa4e796b2cb8744c361e0249e1907e75e21b8ab0
apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.tshttps://github.com/simstudioai/sim/pull/4559/files#diff-1a0584ccf9cc4bacd55ce19aeeea8d807c39f36c365fa5b6638587aad38c700d
View file https://github.com/simstudioai/sim/blob/6b350d063379b2ea8502a0061fa76a890faf8d30/apps/sim/app/workspace/%5BworkspaceId%5D/home/hooks/use-chat.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/4559/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/4559/files#diff-1a0584ccf9cc4bacd55ce19aeeea8d807c39f36c365fa5b6638587aad38c700d
https://github.com/simstudioai/sim/pull/4559/files#diff-1a0584ccf9cc4bacd55ce19aeeea8d807c39f36c365fa5b6638587aad38c700d
Please reload this pagehttps://github.com/simstudioai/sim/pull/4559/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/4559/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.