Skip to content

Commit

Permalink
Исправляет работу с якорными ссылками
Browse files Browse the repository at this point in the history
  • Loading branch information
igsekor committed Dec 19, 2023
1 parent 4215978 commit 0fda77c
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ async function putResourcesInCache(cacheKey, paths) {
}

async function putPageInCache(cacheKey, page, loadRelated = true) {
const response = await putResInCache(cacheKey, page)
const response = await putResInCache(cacheKey, page.replace(/\/#.+$/, ''))
if (typeof page === 'string' && page.match(/^\/(a11y|css|html|js|tools|recipes)\/.+\//)) {
try {
const pageJson = await (await fetch(`${page}index.json`)).json()
Expand Down Expand Up @@ -377,11 +377,6 @@ async function cacheStrategyImpl({ cacheKey, request, preloadResponsePromise, fa
return new Response()
}

// Игнорирует кеширование страниц с якорями
if (request.url.indexOf('#') > -1) {
return new Response()
}

// Игнорирует кеширование запросов методом POST
if (request.method === 'POST') {
return new Response()
Expand Down

0 comments on commit 0fda77c

Please sign in to comment.