Skip to content

Commit bda6339

Browse files
authored
Merge pull request #7836 from maiieul/fix-preloader-not-preloading-prefetch-bundles-deps
fix: preloader not preloading prefetch bundles deps because probability is too small
2 parents 0a6f6e3 + a74c0e5 commit bda6339

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

.changeset/slimy-lizards-switch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@builder.io/qwik': patch
3+
---
4+
5+
FIX: preloader now preloads bundles as long as they are part of the current viewport's bundles graph, even if their probability is very small

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ test('preloader script', () => {
2121
* dereference objects etc, but that actually results in worse compression
2222
*/
2323
const compressed = compress(Buffer.from(preLoader), { mode: 1, quality: 11 });
24-
expect([compressed.length, preLoader.length]).toEqual([1875, 5567]);
24+
expect([compressed.length, preLoader.length]).toEqual([1872, 5549]);
2525
});

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,7 @@ export const adjustProbabilities = (
170170
if (
171171
// don't queue until we have initialized the preloader
172172
base != null &&
173-
bundle.$state$ < BundleImportState_Preload &&
174-
bundle.$inverseProbability$ < config.$invPreloadProbability$
173+
bundle.$state$ < BundleImportState_Preload
175174
) {
176175
if (bundle.$state$ === BundleImportState_None) {
177176
bundle.$state$ = BundleImportState_Queued;

0 commit comments

Comments
 (0)