Skip to content

Commit

Permalink
Make prefetching works again. (vercel#422)
Browse files Browse the repository at this point in the history
  • Loading branch information
arunoda authored and rauchg committed Dec 17, 2016
1 parent de6521a commit 37a9c66
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 4 additions & 1 deletion client/next-prefetcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ function sendReply (e, result) {

function cacheUrl (url) {
const req = new self.Request(url, {
mode: 'no-cors'
mode: 'no-cors',
headers: {
'Accept': 'application/json'
}
})

return self.caches.open(CACHE_NAME)
Expand Down
5 changes: 1 addition & 4 deletions lib/prefetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,8 @@ export function prefetch (href) {

let { pathname } = urlParse(href)
// Add support for the index page
if (pathname === '/') {
pathname = '/index'
}

const url = `${pathname}.json`
const url = `/_next/pages${pathname}`
if (PREFETCHED_URLS[url]) return

messenger.send({ action: 'ADD_URL', url: url })
Expand Down

0 comments on commit 37a9c66

Please sign in to comment.