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,24 +23,21 @@ export function usePrepareTemplate(params: {
const removeArray: (() => void)[] = [];
(async () => {
const prLoadedArray: Promise<void>[] = [];
styles.reverse().forEach(href => {
for (const style of [...styles].reverse()) {
const { prLoaded, remove } = headInsert({
"type": "css",
"position": "prepend",
href
"href": style
});
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) {
return;
if (isUnmounted) {
return;
}
}
setReady();