Preserve css order

This commit is contained in:
Joseph Garrone 2023-10-09 00:49:35 +02:00
parent 5398590939
commit 36f404e17d

View File

@ -23,25 +23,22 @@ export function usePrepareTemplate(params: {
const removeArray: (() => void)[] = []; const removeArray: (() => void)[] = [];
(async () => { (async () => {
const prLoadedArray: Promise<void>[] = []; for (const style of [...styles].reverse()) {
styles.reverse().forEach(href => {
const { prLoaded, remove } = headInsert({ const { prLoaded, remove } = headInsert({
"type": "css", "type": "css",
"position": "prepend", "position": "prepend",
href "href": style
}); });
removeArray.push(remove); removeArray.push(remove);
prLoadedArray.push(prLoaded); // TODO: Find a way to do that in parallel (without breaking the order)
}); await prLoaded;
await Promise.all(prLoadedArray);
if (isUnmounted) { if (isUnmounted) {
return; return;
} }
}
setReady(); setReady();
})(); })();