Skip to content

Hosted site rendering jankiness fix#4255

Merged
burieberry merged 1 commit intomainfrom
cs-10521-host-mode-rendering-jankiness-fix
Mar 26, 2026
Merged

Hosted site rendering jankiness fix#4255
burieberry merged 1 commit intomainfrom
cs-10521-host-mode-rendering-jankiness-fix

Conversation

@burieberry
Copy link
Contributor

It looks like we added a reset for tests that clears ssr-injected scoped styles at every construction, but it's running outside of tests, too. resetState() calls clearInjectedScopedCSS() which seems to be the cause of missing css in the template rendered via ssr.

Comment on lines 125 to 131
private clearSessionCaches() {
// This clears cached module fetches and scoped styles at session/test
// boundaries so private realm assets do not leak across owners.
clearFetchCache();
clearInjectedScopedCSS();
clearKnownFileMetaUrls();
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

LoaderService's resetState() calls clearSessionCaches() which does these things. Do we actually need any of them running each time at construction time outside of tests? Want to make sure this change I made is ok @habdelra

Copy link
Contributor

@habdelra habdelra Mar 26, 2026

Choose a reason for hiding this comment

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

so the CSS in the tests builds up and is a massive cause of memory leaks. like we end up with millions of DOM elements by the end of the tests from CSS. we defintely want this logic running in the tests. but i'm ok with removing them outside of the tests. probably more long term we should think of a way to clean up the CSS that is no longer being used, it is a memory leak.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is there a ticket for it? seems like it could be part of the memory use increase, the more the app is used

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought there was a long-standing issue about this but haven’t been able to find it. But I think this will become moot if/when we move to Vite, because it’s style-loader Webpack plugin that inserts this CSS, and hopefully in Vite-land things would be more sensible. But Ed would probably know better about that

Comment on lines -44 to -45
// this clears the fetch cache in between tests
this.resetState();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this comment seems to indicate that this code was only meant for tests?

Copy link
Contributor

Choose a reason for hiding this comment

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

eep, agreed

@github-actions
Copy link

Preview deployments

@github-actions
Copy link

Host Test Results

    1 files  ±0      1 suites  ±0   2h 9m 29s ⏱️ +9s
2 056 tests ±0  2 041 ✅ ±0  15 💤 ±0  0 ❌ ±0 
2 071 runs  ±0  2 056 ✅ ±0  15 💤 ±0  0 ❌ ±0 

Results for commit c3992b7. ± Comparison against base commit a059fc7.

@burieberry burieberry marked this pull request as ready for review March 26, 2026 17:05
@burieberry burieberry requested review from a team and habdelra March 26, 2026 17:06
Copy link
Contributor

@backspace backspace left a comment

Choose a reason for hiding this comment

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

Thanks for figuring this out, I’d like to find a way we can detect this type of failure via the alerts, but I think it’s better to have it fixed

@burieberry burieberry merged commit 5d0930b into main Mar 26, 2026
118 of 119 checks passed
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.

3 participants