Skip to content

Commit 201f3c8

Browse files
committed
Say if no personalizations and some caching
1 parent 1949ba8 commit 201f3c8

File tree

2 files changed

+27
-20
lines changed

2 files changed

+27
-20
lines changed

html.js

+16-11
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ export const RootBody = ({ rooms, whoIsInTheHub, personalizations }) => {
9595
Each personalization is applied and then repeated as escaped HTML in text
9696
form so you can see exactly what's going on.
9797
</p>`;
98+
if (!personalizations || personalizations.length === 0) {
99+
body += html`<p><em>You have no personalizations</em></p>`;
100+
}
98101
body += `<ul>`;
99102
body += personalizations
100103
.map((url) => {
@@ -189,17 +192,19 @@ export const Personalization = ({
189192
190193
<a href="/">Back to RCVerse Home</a>
191194
192-
<ol>
193-
${personalizations
194-
.map((url, index) =>
195-
PersonalizationListItem({
196-
url,
197-
index,
198-
total: personalizations.length,
199-
}),
200-
)
201-
.join("\n")}
202-
</ol>
195+
${!personalizations || personalizations.length == 0
196+
? html`<p><em>You have no personalizations</em></p>`
197+
: html`<ol>
198+
${personalizations
199+
.map((url, index) =>
200+
PersonalizationListItem({
201+
url,
202+
index,
203+
total: personalizations.length,
204+
}),
205+
)
206+
.join("\n")}
207+
</ol>`}
203208
204209
<h2>Add personalization</h2>
205210

public/service-worker-driver.js

+11-9
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,15 @@ self.addEventListener("install", async function (event) {
4646
event,
4747
);
4848

49-
// TODO: Make index.html into a shell that can be cached and loaded instantly
50-
// event.waitUntil(
51-
// caches.open(RCVERSE_SERVICE_WORKER_CACHE_NAME).then(function (cache) {
52-
// return cache.addAll([
53-
// "index.html"
54-
// ]);
55-
// }),
56-
// );
49+
event.waitUntil(
50+
caches.open(RCVERSE_SERVICE_WORKER_CACHE_NAME).then(function (cache) {
51+
return cache.addAll([
52+
// TODO: Make index.html into a shell that can be cached and loaded instantly
53+
// "index.html"
54+
"favicon.ico",
55+
]);
56+
}),
57+
);
5758

5859
// TODO: Not sure when skipWaiting is necessary.
5960
// https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/skipWaiting
@@ -85,7 +86,8 @@ self.addEventListener("fetch", async function (event) {
8586
// There's two URLs by which these are served?
8687
event.request.url.match(
8788
/https:\/\/assets.recurse.com\/rails\/active_storage\/representations/,
88-
)
89+
) ||
90+
event.request.url.startsWith("https://unpkg.com/htmx.org")
8991
) {
9092
event.respondWith(cacheFirst(event.request));
9193
return;

0 commit comments

Comments
 (0)