Skip to content

Commit 090e940

Browse files
committed
improved naming of inner appSymbols
1 parent 0b69dd3 commit 090e940

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

packages/qwik-city/src/runtime/src/service-worker/setup.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const setupServiceWorkerScope = (
1616
linkBundles: LinkBundle[]
1717
) => {
1818
const swFetch = swScope.fetch.bind(swScope);
19-
const appSymbols = computeAppSymbols(appBundles);
19+
const symbolToBundles = computeAppSymbols(appBundles);
2020

2121
swScope.addEventListener('activate', (event) => {
2222
(async () => {
@@ -75,13 +75,18 @@ export const setupServiceWorkerScope = (
7575
}
7676

7777
if (Array.isArray(data.symbols)) {
78-
logger.log('[PREFETCHING SYMBOLS]: ', resolveSymbols(appSymbols, data.symbols));
78+
logger.log(
79+
'[PREFETCHING SYMBOLS]: ',
80+
data.symbols,
81+
' bundles: ',
82+
resolveSymbols(symbolToBundles, data.symbols)
83+
);
7984
prefetchBundleNames(
8085
appBundles,
8186
qBuildCache,
8287
swFetch,
8388
baseUrl,
84-
resolveSymbols(appSymbols, data.symbols)
89+
resolveSymbols(symbolToBundles, data.symbols)
8590
);
8691
}
8792
}

packages/qwik-city/src/runtime/src/service-worker/utils.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ export const resolveSymbols = (appSymbols: Map<string, string>, symbolsHashes: s
2424
symbolsHashes.map((s) => appSymbols.get(s)).filter((s) => s != null) as string[];
2525

2626
export const computeAppSymbols = (appBundles: AppBundle[]): AppSymbols => {
27-
const appSymbols = new Map<string, string>();
27+
const symbolToBundles = new Map<string, string>();
2828
for (const bundle of appBundles) {
29-
const hashes = bundle[2];
30-
if (hashes) {
31-
for (const hash of hashes) {
32-
appSymbols.set(hash, bundle[0]);
29+
const symbols = bundle[2];
30+
if (symbols) {
31+
for (const symbol of symbols) {
32+
symbolToBundles.set(symbol, bundle[0]);
3333
}
3434
}
3535
}
36-
return appSymbols;
36+
return symbolToBundles;
3737
};

0 commit comments

Comments
 (0)