Conversation
| 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(); | ||
| } |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
is there a ticket for it? seems like it could be part of the memory use increase, the more the app is used
There was a problem hiding this comment.
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
| // this clears the fetch cache in between tests | ||
| this.resetState(); |
There was a problem hiding this comment.
this comment seems to indicate that this code was only meant for tests?
Preview deployments |
backspace
left a comment
There was a problem hiding this comment.
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
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()callsclearInjectedScopedCSS()which seems to be the cause of missing css in the template rendered via ssr.