@nuxt/vue-app
Advanced tools
Comparing version 2.13.3 to 2.14.0
/*! | ||
* @nuxt/vue-app v2.13.3 (c) 2016-2020 | ||
* @nuxt/vue-app v2.14.0 (c) 2016-2020 | ||
@@ -32,3 +32,2 @@ * - All the amazing contributors | ||
files: [ | ||
'nuxt/config.json', | ||
'App.js', | ||
@@ -35,0 +34,0 @@ 'client.js', |
{ | ||
"name": "@nuxt/vue-app", | ||
"version": "2.13.3", | ||
"version": "2.14.0", | ||
"repository": "nuxt/nuxt.js", | ||
@@ -12,2 +12,3 @@ "license": "MIT", | ||
"vetur", | ||
"web-types", | ||
"index.d.ts" | ||
@@ -28,3 +29,4 @@ ], | ||
"access": "public" | ||
} | ||
}, | ||
"web-types": "web-types/web-types.json" | ||
} |
@@ -17,3 +17,4 @@ import Vue from 'vue' | ||
getQueryDiff, | ||
globalHandleError | ||
globalHandleError, | ||
isSamePath | ||
} from './utils.js' | ||
@@ -529,6 +530,8 @@ import { createApp<% if (features.layouts) { %>, NuxtError<% } %> } from './index.js' | ||
<% if (isFullStatic && store) { %> | ||
// Replay store mutations, catching to avoid error page on SPA fallback | ||
promises.push(this.fetchPayload(to.path).then(payload => { | ||
payload.mutations.forEach(m => { this.$store.commit(m[0], m[1]) }) | ||
}).catch(err => null)) | ||
if (!this.isPreview && !spaFallback) { | ||
// Replay store mutations, catching to avoid error page on SPA fallback | ||
promises.push(this.fetchPayload(to.path).then(payload => { | ||
payload.mutations.forEach(m => { this.$store.commit(m[0], m[1]) }) | ||
}).catch(err => null)) | ||
} | ||
<% } %> | ||
@@ -832,3 +835,3 @@ | ||
try { | ||
const payload = await _app.fetchPayload(_app.context.route.path) | ||
const payload = await _app.fetchPayload(NUXT.routePath || _app.context.route.path) | ||
Object.assign(NUXT, payload) | ||
@@ -891,10 +894,13 @@ } catch (err) {} | ||
// Fix in static: remove trailing slash to force hydration | ||
if (process.static && NUXT.serverRendered && NUXT.routePath !== '/' && NUXT.routePath.slice(-1) !== '/' && _app.context.route.path.slice(-1) === '/') { | ||
_app.context.route.path = _app.context.route.path.replace(/\/+$/, '') | ||
// Full static, if server-rendered: hydrate, to allow custom redirect to generated page | ||
<% if (isFullStatic) { %> | ||
if (NUXT.serverRendered) { | ||
return mount() | ||
} | ||
// If page already is server rendered and it was done on the same route path as client side render | ||
if (NUXT.serverRendered && NUXT.routePath === _app.context.route.path) { | ||
mount() | ||
return | ||
<% } else { %> | ||
// Fix in static: remove trailing slash to force hydration | ||
if (NUXT.serverRendered && isSamePath(NUXT.routePath, _app.context.route.path)) { | ||
return mount() | ||
} | ||
<% } %> | ||
@@ -901,0 +907,0 @@ // First render on client-side |
@@ -114,3 +114,4 @@ import Vue from 'vue' | ||
const { href } = this.$router.resolve(this.to, this.$route, this.append) | ||
this.$nuxt.fetchPayload(href).catch(() => {}) | ||
if (this.$nuxt) | ||
this.$nuxt.fetchPayload(href).catch(() => {}) | ||
} | ||
@@ -117,0 +118,0 @@ <% } %> |
@@ -651,3 +651,3 @@ import Vue from 'vue' | ||
export const urlJoin = function urlJoin () { | ||
export function urlJoin () { | ||
return [].slice | ||
@@ -659,1 +659,9 @@ .call(arguments) | ||
} | ||
export function stripTrailingSlash (path) { | ||
return path.replace(/\/+$/, '') || '/' | ||
} | ||
export function isSamePath (p1, p2) { | ||
return stripTrailingSlash(p1) === stripTrailingSlash(p2) | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
165248
3547