fix: history heading shows when only index is cached
This commit is contained in:
parent
7c949d6030
commit
9e2818004a
1 changed files with 6 additions and 7 deletions
|
@ -28,19 +28,18 @@ const {postDivSelector, skipSave = false} = Astro.props;
|
|||
}
|
||||
}
|
||||
|
||||
const cachedRequests = await cache.keys();
|
||||
const list = document.querySelector('#post-list');
|
||||
const cachedRequests = (await cache.keys())
|
||||
.filter(request => {
|
||||
const urlObj = new URL(request.url);
|
||||
return urlObj.search !== '';
|
||||
});
|
||||
|
||||
if(cachedRequests?.length) {
|
||||
const list = document.querySelector('#post-list');
|
||||
const heading = document.querySelector('#library span#heading') as HTMLHeadingElement;
|
||||
heading.innerHTML = 'History';
|
||||
|
||||
cachedRequests
|
||||
// temporary delete all cached errors
|
||||
.filter(request => {
|
||||
const urlObj = new URL(request.url);
|
||||
return urlObj.search !== '';
|
||||
})
|
||||
.reverse()
|
||||
.forEach(async (request) => {
|
||||
const {url} = request;
|
||||
|
|
Loading…
Reference in a new issue