Skip to content

Commit e7cf323

Browse files
snaptopixelmanucorporat
authored andcommitted
fix(lifecycle): using css-in-js with no styles causes FOUC (#1550)
1 parent bd20c11 commit e7cf323

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

src/runtime/bootstrap-lazy.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,8 @@ export const bootstrapLazy = (lazyBundles: d.LazyBundlesRuntimeData, options: d.
132132
}
133133
}));
134134

135-
136-
if (BUILD.style) {
137-
// visibilityStyle.innerHTML = cmpTags.map(t => `${t}:not(.hydrated)`) + '{display:none}';
138-
visibilityStyle.innerHTML = cmpTags + '{visibility:hidden}.hydrated{visibility:inherit}';
139-
visibilityStyle.setAttribute('data-styles', '');
140-
head.insertBefore(visibilityStyle, y ? y.nextSibling : head.firstChild);
141-
}
135+
// visibilityStyle.innerHTML = cmpTags.map(t => `${t}:not(.hydrated)`) + '{display:none}';
136+
visibilityStyle.innerHTML = cmpTags + '{visibility:hidden}.hydrated{visibility:inherit}';
137+
visibilityStyle.setAttribute('data-styles', '');
138+
head.insertBefore(visibilityStyle, y ? y.nextSibling : head.firstChild);
142139
};

src/runtime/update-component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export const postUpdateComponent = (elm: d.HostElement, hostRef: d.HostRef, ance
139139
if (!(hostRef.$flags$ & HOST_FLAGS.hasLoadedComponent)) {
140140
hostRef.$flags$ |= HOST_FLAGS.hasLoadedComponent;
141141

142-
if (BUILD.lazyLoad && BUILD.style && BUILD.cssAnnotations) {
142+
if (BUILD.lazyLoad && BUILD.cssAnnotations) {
143143
// DOM WRITE!
144144
// add the css class that this element has officially hydrated
145145
elm.classList.add(HYDRATED_CLASS);

0 commit comments

Comments
 (0)