Preserve css order
This commit is contained in:
parent
5398590939
commit
36f404e17d
@ -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();
|
||||||
})();
|
})();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user