mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 23:52:06 +00:00
perf(vue-renderer): early return render
when redirect happens (#6973)
This commit is contained in:
parent
b71eaee879
commit
bfad1e627b
@ -83,6 +83,14 @@ export default class SSRRenderer extends BaseRenderer {
|
||||
APP = `<div id="${this.serverContext.globals.id}"></div>`
|
||||
}
|
||||
|
||||
if (renderContext.redirected && !renderContext._generate) {
|
||||
return {
|
||||
html: APP,
|
||||
error: renderContext.nuxt.error,
|
||||
redirected: renderContext.redirected
|
||||
}
|
||||
}
|
||||
|
||||
let HEAD = ''
|
||||
|
||||
// Inject head meta
|
||||
|
@ -155,6 +155,7 @@ describe('basic ssr', () => {
|
||||
test('/redirect', async () => {
|
||||
const { html, redirected } = await nuxt.server.renderRoute('/redirect')
|
||||
expect(html).toContain('<div id="__nuxt"></div>')
|
||||
expect(html).not.toContain('window.__NUXT__')
|
||||
expect(redirected.path === '/').toBe(true)
|
||||
expect(redirected.status === 302).toBe(true)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user