Skip to content

Commit 5d0930b

Browse files
authored
do not clear ssr-injected scoped styles at every construction (keeping only for tests) (#4255)
this caused css flashes and jankiness on hosted site render
1 parent a059fc7 commit 5d0930b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

packages/host/app/services/loader-service.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { registerDestructor } from '@ember/destroyable';
22
import type Owner from '@ember/owner';
33
import Service, { service } from '@ember/service';
44

5+
import { isTesting } from '@embroider/macros';
56
import { tracked } from '@glimmer/tracking';
67

78
import type { FetcherMiddlewareHandler } from '@cardstack/runtime-common';
@@ -41,8 +42,10 @@ export default class LoaderService extends Service {
4142
constructor(owner: Owner) {
4243
super(owner);
4344
this.reset.register(this);
44-
// this clears the fetch cache in between tests
45-
this.resetState();
45+
if (isTesting()) {
46+
// clears the fetch cache and SSR-injected scoped styles in between tests
47+
this.resetState();
48+
}
4649
registerDestructor(this, () => this.resetState());
4750
}
4851

0 commit comments

Comments
 (0)