diff --git a/src/bggpipe/templates/pages/catalog.html b/src/bggpipe/templates/pages/catalog.html index 929af89..46f8778 100644 --- a/src/bggpipe/templates/pages/catalog.html +++ b/src/bggpipe/templates/pages/catalog.html @@ -39,8 +39,12 @@ function render() { : `Nothing extracted yet — start on the photos page.`}
`; } +let LAST = null; async function refresh() { const state = await fetchJSON("/api/state"); + const payload = JSON.stringify(state.catalog); + if (payload === LAST) return; + LAST = payload; CATALOG = state.catalog; render(); } diff --git a/src/bggpipe/templates/pages/library.html b/src/bggpipe/templates/pages/library.html index dee19df..45135be 100644 --- a/src/bggpipe/templates/pages/library.html +++ b/src/bggpipe/templates/pages/library.html @@ -45,8 +45,13 @@ function render() { Run the pipeline throughenrich to fill these shelves.`}`;
}
+let LAST = null;
async function refresh() {
- GAMES = await fetchJSON("/api/library");
+ const games = await fetchJSON("/api/library");
+ const payload = JSON.stringify(games);
+ if (payload === LAST) return;
+ LAST = payload;
+ GAMES = games;
render();
}
diff --git a/src/bggpipe/templates/pages/photos.html b/src/bggpipe/templates/pages/photos.html
index 4957017..ec5c530 100644
--- a/src/bggpipe/templates/pages/photos.html
+++ b/src/bggpipe/templates/pages/photos.html
@@ -59,11 +59,16 @@ function render(state, photos) {
`).join("");
}
+let LAST = null;
async function refresh() {
const [state, photos] = await Promise.all([
fetchJSON("/api/state"),
fetchJSON("/api/photos-list"),
]);
+ // re-render only on change: rebuilding innerHTML re-renders every