Skip to content

Commit

Permalink
Fix module sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
infloent committed Nov 12, 2024
1 parent 84ae3d0 commit 80bdf0d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions scripts/render/dom-reducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,14 @@ export const toWebComponent = (virtualDom) => {
export const loadModules = (nodes, extra = {}) => {
const modules = { ...raqnLoadedComponents, ...extra };
window.raqnOnComponentsLoaded = Object.keys(modules)
.sort((a, b) => modules[a].priority - modules[b].priority)
.flatMap((component) => {
const { tag, priority } = modules[component];
.filter((component) => modules[component]?.module?.path)
.sort((a, b) => modules[a].module.priority - modules[b].module.priority)
.forEach((component) => {
const {
module: { priority },
tag,
} = modules[component];
if (window.raqnComponents[tag]) return window.raqnComponents[tag];
if (!modules[component]?.module?.path) return [];
return new Promise((resolve, reject) => {
setTimeout(async () => {
try {
Expand Down

0 comments on commit 80bdf0d

Please sign in to comment.