Skip to content

Commit 4a22d7f

Browse files
committed
chore: preload all probability 1 without limit
1 parent 538ec66 commit 4a22d7f

File tree

1 file changed

+18
-8
lines changed
  • packages/qwik/src/core/preloader

1 file changed

+18
-8
lines changed

packages/qwik/src/core/preloader/queue.ts

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,29 @@ export const trigger = () => {
7878
while (queue.length) {
7979
const bundle = queue[0];
8080
const inverseProbability = bundle.$inverseProbability$;
81+
console.log('inverseProbability', inverseProbability);
8182
const probability = 1 - inverseProbability;
83+
console.log('probability', probability);
8284
console.log('limit :', limit);
83-
const allowedPreloads = graph
84-
? // The more likely the bundle, the more simultaneous preloads we want to allow
85-
Math.max(1, (Number(limit) || config[maxSimultaneousPreloadsStr]) * probability)
86-
: // While the graph is not available, we limit to 2 preloads
87-
2;
88-
console.log('allowedPreloads :', allowedPreloads);
89-
if (preloadCount < allowedPreloads) {
85+
86+
if (probability === 1) {
9087
queue.shift();
9188
preloadOne(bundle);
9289
} else {
93-
break;
90+
const allowedPreloads = graph
91+
? // The more likely the bundle, the more simultaneous preloads we want to allow
92+
Math.max(1, (Number(limit) || config[maxSimultaneousPreloadsStr]) * probability)
93+
: // While the graph is not available, we limit to 2 preloads
94+
2;
95+
console.log('allowedPreloads :', allowedPreloads);
96+
console.log('preloadCount :', preloadCount);
97+
98+
if (preloadCount < allowedPreloads) {
99+
queue.shift();
100+
preloadOne(bundle);
101+
} else {
102+
break;
103+
}
94104
}
95105
}
96106
/**

0 commit comments

Comments
 (0)