Skip to content

Commit

Permalink
fix(templates): resolve so many minor issues in Boilerplate project t…
Browse files Browse the repository at this point in the history
…emplate #6178 #6180
  • Loading branch information
msynk authored Nov 30, 2023
1 parent 8758316 commit 8a53a21
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
</head>

<body>
<h1>111</h1>
<Routes @rendermode="@renderMode" />
<script src="_framework/blazor.web.js" autostart="false"></script>
<script src="_content/Bit.Bswup/bit-bswup.js"
Expand Down
13 changes: 10 additions & 3 deletions src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,11 @@ async function handleFetch(e) {
let asset = UNIQUE_ASSETS.find(a => a[shouldServeIndexHtml ? 'url' : 'reqUrl'][caseMethod]() === requestUrl[caseMethod]());

if (!asset) { // for assets that has asp-append-version or similar type of url versioning
const url = new URL(requestUrl);
const reqUrl = `${url.origin}${url.pathname}`;
asset = UNIQUE_ASSETS.find(a => a.reqUrl[caseMethod]() === reqUrl[caseMethod]());
try {
const url = new URL(requestUrl);
const reqUrl = `${url.origin}${url.pathname}`;
asset = UNIQUE_ASSETS.find(a => a.reqUrl[caseMethod]() === reqUrl[caseMethod]());
} catch { }
}

if (!asset?.url) {
Expand Down Expand Up @@ -271,6 +273,11 @@ async function createAssetsCache(ignoreProgressReport = false) {
}
}

const defaultAsset = UNIQUE_ASSETS.find(a => a.url === DEFAULT_URL);
if (!updatedAssets.includes(defaultAsset)) {
updatedAssets.push(defaultAsset); // get the latest version of the default doc in each update!
}

diag('oldUrls:', oldUrls);
diag('updatedAssets:', updatedAssets);

Expand Down

0 comments on commit 8a53a21

Please sign in to comment.