Skip to content

Commit

Permalink
refactor: not detect modern browser if modern mode is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkdo committed Feb 14, 2019
1 parent 636e7e1 commit 2b4d79c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/server/src/middleware/modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ const detectModernBrowser = ({ socket = {}, headers }) => {
}

const setModernMode = (req, options) => {
const { socket = {} } = req
const { isModernBrowser } = socket
const { socket: { isModernBrowser } = {} } = req
if (options.modern === 'server') {
req.modernMode = isModernBrowser
}
Expand All @@ -65,7 +64,9 @@ const setModernMode = (req, options) => {

export default ({ context }) => (req, res, next) => {
detectModernBuild(context)
detectModernBrowser(req)
setModernMode(req, context.options)
if (context.options.modern !== false) {
detectModernBrowser(req)
setModernMode(req, context.options)
}
next()
}

0 comments on commit 2b4d79c

Please sign in to comment.