fix: history heading shows when only index is cached

This commit is contained in:
Ayo 2023-06-15 08:43:41 +02:00
parent 7c949d6030
commit 9e2818004a

View file

@ -28,19 +28,18 @@ const {postDivSelector, skipSave = false} = Astro.props;
} }
} }
const cachedRequests = await cache.keys(); const cachedRequests = (await cache.keys())
const list = document.querySelector('#post-list'); .filter(request => {
const urlObj = new URL(request.url);
return urlObj.search !== '';
});
if(cachedRequests?.length) { if(cachedRequests?.length) {
const list = document.querySelector('#post-list');
const heading = document.querySelector('#library span#heading') as HTMLHeadingElement; const heading = document.querySelector('#library span#heading') as HTMLHeadingElement;
heading.innerHTML = 'History'; heading.innerHTML = 'History';
cachedRequests cachedRequests
// temporary delete all cached errors
.filter(request => {
const urlObj = new URL(request.url);
return urlObj.search !== '';
})
.reverse() .reverse()
.forEach(async (request) => { .forEach(async (request) => {
const {url} = request; const {url} = request;