Skip to content

Commit d0baf34

Browse files
committed
chore(release): 2.2.2
1 parent 00c0939 commit d0baf34

8 files changed

+499
-459
lines changed

Diff for: CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
### [2.2.2](https://github.com/nuxt/vue-meta/compare/v2.2.1...v2.2.2) (2019-08-30)
6+
7+
8+
### Bug Fixes
9+
10+
* workaround for memoryleak in destroyed hook ([ec7b1fb](https://github.com/nuxt/vue-meta/commit/ec7b1fb))
11+
* **types:** add "content" property to MetaPropertyEquiv and remove "name" ([#436](https://github.com/nuxt/vue-meta/issues/436)) ([4384f44](https://github.com/nuxt/vue-meta/commit/4384f44))
12+
513
### [2.2.1](https://github.com/nuxt/vue-meta/compare/v2.2.0...v2.2.1) (2019-08-04)
614

715

Diff for: dist/vue-meta.common.js

+122-114
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* vue-meta v2.2.1
2+
* vue-meta v2.2.2
33
* (c) 2019
44
* - Declan de Wet
55
* - Sébastien Chopin (@Atinux)
@@ -13,7 +13,7 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
1313

1414
var deepmerge = _interopDefault(require('deepmerge'));
1515

16-
var version = "2.2.1";
16+
var version = "2.2.2";
1717

1818
// store an id to keep track of DOM updates
1919
var batchId = null;
@@ -240,137 +240,145 @@ function createMixin(Vue, options) {
240240
// _vnode is used to know that it's attached to a real component
241241
// useful if we use some mixin to add some meta tags (like nuxt-i18n)
242242

243-
if (!isUndefined(this.$options[options.keyName]) && this.$options[options.keyName] !== null) {
244-
if (!this.$root._vueMeta) {
245-
this.$root._vueMeta = {
246-
appId: appId
247-
};
248-
appId++;
249-
} // to speed up updates we keep track of branches which have a component with vue-meta info defined
250-
// if _vueMeta = true it has info, if _vueMeta = false a child has info
243+
if (isUndefined(this.$options[options.keyName]) || this.$options[options.keyName] === null) {
244+
return;
245+
}
251246

247+
if (!this.$root._vueMeta) {
248+
this.$root._vueMeta = {
249+
appId: appId
250+
};
251+
appId++;
252+
} // to speed up updates we keep track of branches which have a component with vue-meta info defined
253+
// if _vueMeta = true it has info, if _vueMeta = false a child has info
252254

253-
if (!this._vueMeta) {
254-
this._vueMeta = true;
255-
var p = this.$parent;
256255

257-
while (p && p !== this.$root) {
258-
if (isUndefined(p._vueMeta)) {
259-
p._vueMeta = false;
260-
}
256+
if (!this._vueMeta) {
257+
this._vueMeta = true;
258+
var p = this.$parent;
261259

262-
p = p.$parent;
260+
while (p && p !== this.$root) {
261+
if (isUndefined(p._vueMeta)) {
262+
p._vueMeta = false;
263263
}
264-
} // coerce function-style metaInfo to a computed prop so we can observe
265-
// it on creation
266264

265+
p = p.$parent;
266+
}
267+
} // coerce function-style metaInfo to a computed prop so we can observe
268+
// it on creation
267269

268-
if (isFunction(this.$options[options.keyName])) {
269-
if (!this.$options.computed) {
270-
this.$options.computed = {};
271-
}
272270

273-
this.$options.computed.$metaInfo = this.$options[options.keyName];
271+
if (isFunction(this.$options[options.keyName])) {
272+
if (!this.$options.computed) {
273+
this.$options.computed = {};
274+
}
275+
276+
this.$options.computed.$metaInfo = this.$options[options.keyName];
274277

275-
if (!this.$isServer) {
276-
// if computed $metaInfo exists, watch it for updates & trigger a refresh
277-
// when it changes (i.e. automatically handle async actions that affect metaInfo)
278-
// credit for this suggestion goes to [Sébastien Chopin](https://github.com/Atinux)
279-
ensuredPush(this.$options, 'created', function () {
280-
_this.$watch('$metaInfo', function () {
281-
triggerUpdate(this, 'watcher');
282-
});
278+
if (!this.$isServer) {
279+
// if computed $metaInfo exists, watch it for updates & trigger a refresh
280+
// when it changes (i.e. automatically handle async actions that affect metaInfo)
281+
// credit for this suggestion goes to [Sébastien Chopin](https://github.com/Atinux)
282+
ensuredPush(this.$options, 'created', function () {
283+
_this.$watch('$metaInfo', function () {
284+
_this.__metaInfo = undefined;
285+
triggerUpdate(_this, 'watcher');
283286
});
284-
}
285-
} // force an initial refresh on page load and prevent other lifecycleHooks
286-
// to triggerUpdate until this initial refresh is finished
287-
// this is to make sure that when a page is opened in an inactive tab which
288-
// has throttled rAF/timers we still immediately set the page title
289-
290-
291-
if (isUndefined(this.$root._vueMeta.initialized)) {
292-
this.$root._vueMeta.initialized = this.$isServer;
293-
294-
if (!this.$root._vueMeta.initialized) {
295-
ensuredPush(this.$options, 'beforeMount', function () {
296-
// if this Vue-app was server rendered, set the appId to 'ssr'
297-
// only one SSR app per page is supported
298-
if (_this.$root.$el && _this.$root.$el.hasAttribute && _this.$root.$el.hasAttribute('data-server-rendered')) {
299-
_this.$root._vueMeta.appId = options.ssrAppId;
300-
}
301-
}); // we use the mounted hook here as on page load
302-
303-
ensuredPush(this.$options, 'mounted', function () {
304-
if (!_this.$root._vueMeta.initialized) {
305-
// used in triggerUpdate to check if a change was triggered
306-
// during initialization
307-
_this.$root._vueMeta.initializing = true; // refresh meta in nextTick so all child components have loaded
308-
309-
_this.$nextTick(function () {
310-
var _this2 = this;
311-
312-
var _this$$root$$meta$ref = this.$root.$meta().refresh(),
313-
tags = _this$$root$$meta$ref.tags,
314-
metaInfo = _this$$root$$meta$ref.metaInfo; // After ssr hydration (identifier by tags === false) check
315-
// if initialized was set to null in triggerUpdate. That'd mean
316-
// that during initilazation changes where triggered which need
317-
// to be applied OR a metaInfo watcher was triggered before the
318-
// current hook was called
319-
// (during initialization all changes are blocked)
320-
321-
322-
if (tags === false && this.$root._vueMeta.initialized === null) {
323-
this.$nextTick(function () {
324-
return triggerUpdate(_this2, 'initializing');
325-
});
326-
}
327-
328-
this.$root._vueMeta.initialized = true;
329-
delete this.$root._vueMeta.initializing; // add the navigation guards if they havent been added yet
330-
// they are needed for the afterNavigation callback
331-
332-
if (!options.refreshOnceOnNavigation && metaInfo.afterNavigation) {
333-
addNavGuards(this);
334-
}
335-
});
336-
}
337-
}); // add the navigation guards if requested
338-
339-
if (options.refreshOnceOnNavigation) {
340-
addNavGuards(this);
287+
});
288+
}
289+
} // force an initial refresh on page load and prevent other lifecycleHooks
290+
// to triggerUpdate until this initial refresh is finished
291+
// this is to make sure that when a page is opened in an inactive tab which
292+
// has throttled rAF/timers we still immediately set the page title
293+
294+
295+
if (isUndefined(this.$root._vueMeta.initialized)) {
296+
this.$root._vueMeta.initialized = this.$isServer;
297+
298+
if (!this.$root._vueMeta.initialized) {
299+
ensuredPush(this.$options, 'beforeMount', function () {
300+
// if this Vue-app was server rendered, set the appId to 'ssr'
301+
// only one SSR app per page is supported
302+
if (_this.$root.$el && _this.$root.$el.hasAttribute && _this.$root.$el.hasAttribute('data-server-rendered')) {
303+
_this.$root._vueMeta.appId = options.ssrAppId;
304+
}
305+
}); // we use the mounted hook here as on page load
306+
307+
ensuredPush(this.$options, 'mounted', function () {
308+
if (!_this.$root._vueMeta.initialized) {
309+
// used in triggerUpdate to check if a change was triggered
310+
// during initialization
311+
_this.$root._vueMeta.initializing = true; // refresh meta in nextTick so all child components have loaded
312+
313+
_this.$nextTick(function () {
314+
var _this2 = this;
315+
316+
var _this$$root$$meta$ref = this.$root.$meta().refresh(),
317+
tags = _this$$root$$meta$ref.tags,
318+
metaInfo = _this$$root$$meta$ref.metaInfo; // After ssr hydration (identifier by tags === false) check
319+
// if initialized was set to null in triggerUpdate. That'd mean
320+
// that during initilazation changes where triggered which need
321+
// to be applied OR a metaInfo watcher was triggered before the
322+
// current hook was called
323+
// (during initialization all changes are blocked)
324+
325+
326+
if (tags === false && this.$root._vueMeta.initialized === null) {
327+
this.$nextTick(function () {
328+
return triggerUpdate(_this2, 'initializing');
329+
});
330+
}
331+
332+
this.$root._vueMeta.initialized = true;
333+
delete this.$root._vueMeta.initializing; // add the navigation guards if they havent been added yet
334+
// they are needed for the afterNavigation callback
335+
336+
if (!options.refreshOnceOnNavigation && metaInfo.afterNavigation) {
337+
addNavGuards(this);
338+
}
339+
});
341340
}
341+
}); // add the navigation guards if requested
342+
343+
if (options.refreshOnceOnNavigation) {
344+
addNavGuards(this);
342345
}
343-
} // do not trigger refresh on the server side
346+
}
347+
} // do not trigger refresh on the server side
344348

345349

346-
if (!this.$isServer) {
347-
// no need to add this hooks on server side
348-
updateOnLifecycleHook.forEach(function (lifecycleHook) {
349-
ensuredPush(_this.$options, lifecycleHook, function () {
350-
return triggerUpdate(_this, lifecycleHook);
351-
});
352-
}); // re-render meta data when returning from a child component to parent
350+
if (this.$isServer) {
351+
return;
352+
} // no need to add this hooks on server side
353353

354-
ensuredPush(this.$options, 'destroyed', function () {
355-
// Wait that element is hidden before refreshing meta tags (to support animations)
356-
var interval = setInterval(function () {
357-
if (_this.$el && _this.$el.offsetParent !== null) {
358-
/* istanbul ignore next line */
359-
return;
360-
}
361354

362-
clearInterval(interval);
355+
updateOnLifecycleHook.forEach(function (lifecycleHook) {
356+
ensuredPush(_this.$options, lifecycleHook, function () {
357+
return triggerUpdate(_this, lifecycleHook);
358+
});
359+
});
360+
},
361+
// TODO: move back into beforeCreate when Vue issue is resolved
362+
destroyed: function destroyed() {
363+
var _this3 = this;
364+
365+
// do not trigger refresh:
366+
// - on the server side
367+
// - when the component doesnt have a parent
368+
// - doesnt have metaInfo defined
369+
if (this.$isServer || !this.$parent || !hasMetaInfo(this)) {
370+
return;
371+
} // Wait that element is hidden before refreshing meta tags (to support animations)
363372

364-
if (!_this.$parent) {
365-
/* istanbul ignore next line */
366-
return;
367-
}
368373

369-
triggerUpdate(_this, 'destroyed');
370-
}, 50);
371-
});
374+
var interval = setInterval(function () {
375+
if (_this3.$el && _this3.$el.offsetParent !== null) {
376+
return;
372377
}
373-
}
378+
379+
clearInterval(interval);
380+
triggerUpdate(_this3, 'destroyed');
381+
}, 50);
374382
}
375383
};
376384
}

0 commit comments

Comments
 (0)