Skip to content

Commit

Permalink
fix: explicit disable prerender
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Jun 10, 2020
1 parent 7d564a3 commit 72cfdaf
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ const fetch = (url, { reflect = false, toEncode, ...opts }) =>
return reflect
? resolve({ isRejected: true, error })
: resolve({
url,
html: '',
mode: 'fetch',
headers: error.response ? error.response.headers : {},
statusCode: error.response ? error.response.statusCode : undefined
})
url,
html: '',
mode: 'fetch',
headers: error.response ? error.response.headers : {},
statusCode: error.response ? error.response.statusCode : undefined
})
}
})

Expand Down Expand Up @@ -102,11 +102,11 @@ const prerender = async (

return isFetchResRejected
? {
headers: data.headers || {},
html: '',
url,
mode: 'prerender'
}
headers: data.headers || {},
html: '',
url,
mode: 'prerender'
}
: data
}

Expand All @@ -116,7 +116,7 @@ const isFetchMode = url => autoDomains.includes(getDomainWithoutSuffix(url))

const determinateMode = (url, { prerender }) => {
if (prerender === false || isMediaUrl(url)) return 'fetch'
if (prerender !== 'auto') return 'prerender'
if (prerender === true) return 'prerender'
return isFetchMode(url) ? 'fetch' : 'prerender'
}

Expand Down

0 comments on commit 72cfdaf

Please sign in to comment.