@nuxt/vue-app
Advanced tools
Comparing version 2.4.3 to 2.4.5
@@ -6,2 +6,16 @@ # Change Log | ||
## [2.4.4](https://github.com/nuxt/nuxt.js/compare/v2.4.3...v2.4.4) (2019-02-26) | ||
### Bug Fixes | ||
* **types:** reflect chainlable NuxtLoading methods ([#5104](https://github.com/nuxt/nuxt.js/issues/5104)) ([66273f4](https://github.com/nuxt/nuxt.js/commit/66273f4)) | ||
* **vue-app:** fix `asyncData` memory leak on client-side ([#4966](https://github.com/nuxt/nuxt.js/issues/4966)) ([4086800](https://github.com/nuxt/nuxt.js/commit/4086800)) | ||
* **vue-app:** fix `getNuxtChildComponents` method ([#4969](https://github.com/nuxt/nuxt.js/issues/4969)) ([dbf7099](https://github.com/nuxt/nuxt.js/commit/dbf7099)) | ||
* **vue-app:** use browser to handle scrolling position on page reload and back-navigation from other sites ([#5080](https://github.com/nuxt/nuxt.js/issues/5080)) ([7001312](https://github.com/nuxt/nuxt.js/commit/7001312)) | ||
## [2.4.2](https://github.com/nuxt/nuxt.js/compare/v2.4.1...v2.4.2) (2019-01-30) | ||
@@ -8,0 +22,0 @@ |
/*! | ||
* @nuxt/vue-app v2.4.3 (c) 2016-2019 | ||
* @nuxt/vue-app v2.4.5 (c) 2016-2019 | ||
@@ -4,0 +4,0 @@ * - All the amazing contributors |
{ | ||
"name": "@nuxt/vue-app", | ||
"version": "2.4.3", | ||
"version": "2.4.5", | ||
"repository": "nuxt/nuxt.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -531,3 +531,3 @@ import Vue from 'vue' | ||
$parent.$children.forEach(($child) => { | ||
if ($child.$vnode.data.nuxtChild && !$components.find(c =>(c.$options.__file === $child.$options.__file))) { | ||
if ($child.$vnode && $child.$vnode.data.nuxtChild && !$components.find(c =>(c.$options.__file === $child.$options.__file))) { | ||
$components.push($child) | ||
@@ -534,0 +534,0 @@ } |
@@ -89,3 +89,17 @@ import Vue from 'vue' | ||
if (process.client) { | ||
window.history.scrollRestoration = 'manual' | ||
if ('scrollRestoration' in window.history) { | ||
window.history.scrollRestoration = 'manual' | ||
// reset scrollRestoration to auto when leaving page, allowing page reload | ||
// and back-navigation from other pages to use the browser to restore the | ||
// scrolling position. | ||
window.addEventListener('beforeunload', () => { | ||
window.history.scrollRestoration = 'auto' | ||
}) | ||
// Setting scrollRestoration to manual again when returning to this page. | ||
window.addEventListener('load', () => { | ||
window.history.scrollRestoration = 'manual' | ||
}) | ||
} | ||
} | ||
@@ -92,0 +106,0 @@ const scrollBehavior = function (to, from, savedPosition) { |
import Vue from 'vue' | ||
const noopData = () => ({}) | ||
// window.{{globals.loadedCallback}} hook | ||
@@ -27,8 +25,13 @@ // Useful for jsdom testing or plugins (https://github.com/tmpvar/jsdom#dealing-with-asynchronous-script-loading) | ||
export function applyAsyncData(Component, asyncData) { | ||
const ComponentData = Component.options.data || noopData | ||
// Prevent calling this method for each request on SSR context | ||
if (!asyncData && Component.options.hasAsyncData) { | ||
if ( | ||
// For SSR, we once all this function without second param to just apply asyncData | ||
// Prevent doing this for each SSR request | ||
!asyncData && Component.options.__hasNuxtData | ||
) { | ||
return | ||
} | ||
Component.options.hasAsyncData = true | ||
const ComponentData = Component.options._originDataFn || Component.options.data || function () { return {} } | ||
Component.options._originDataFn = ComponentData | ||
Component.options.data = function () { | ||
@@ -41,2 +44,5 @@ const data = ComponentData.call(this) | ||
} | ||
Component.options.__hasNuxtData = true | ||
if (Component._Ctor && Component._Ctor.options) { | ||
@@ -43,0 +49,0 @@ Component._Ctor.options.data = Component.options.data |
@@ -66,7 +66,7 @@ import Vue from "vue"; | ||
export interface NuxtLoading extends Vue { | ||
fail?(): void; | ||
finish(): void; | ||
increase?(num: number): void; | ||
pause?(): void; | ||
start(): void; | ||
fail?(): NuxtLoading; | ||
finish(): NuxtLoading; | ||
increase?(num: number): NuxtLoading; | ||
pause?(): NuxtLoading; | ||
start(): NuxtLoading; | ||
} | ||
@@ -73,0 +73,0 @@ |
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
133161
2477