Skip to content

Commit b2488c1

Browse files
committed
chore(release): 2.3.3
1 parent 4336b3e commit b2488c1

8 files changed

+249
-229
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.3.3](https://github.com/nuxt/vue-meta/compare/v2.3.2...v2.3.3) (2020-02-26)
6+
7+
8+
### Bug Fixes
9+
10+
* memory leak, use hook events (thanks [#522](https://github.com/nuxt/vue-meta/issues/522)) ([21621e1](https://github.com/nuxt/vue-meta/commit/21621e13f53f45eeef5d75c76ed01c7703ad78b9))
11+
* support once (with skip) client side (fix [#498](https://github.com/nuxt/vue-meta/issues/498)) ([c74c645](https://github.com/nuxt/vue-meta/commit/c74c645d1881e22569a2ea7ac0c903a4f6ee2243))
12+
513
### [2.3.2](https://github.com/nuxt/vue-meta/compare/v2.3.1...v2.3.2) (2020-01-12)
614

715

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

+59-56
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* vue-meta v2.3.2
2+
* vue-meta v2.3.3
33
* (c) 2020
44
* - Declan de Wet
55
* - Sébastien Chopin (@Atinux)
@@ -14,9 +14,11 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
1414

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

17-
var version = "2.3.2";
17+
var version = "2.3.3";
1818

1919
function _typeof(obj) {
20+
"@babel/helpers - typeof";
21+
2022
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
2123
_typeof = function (obj) {
2224
return typeof obj;
@@ -220,7 +222,7 @@ var tagsWithoutEndTag = ['base', 'meta', 'link']; // HTML elements which can hav
220222
var tagsWithInnerContent = ['noscript', 'script', 'style']; // Attributes which are inserted as childNodes instead of HTMLAttribute
221223

222224
var tagAttributeAsInnerContent = ['innerHTML', 'cssText', 'json'];
223-
var tagProperties = ['once', 'template']; // Attributes which should be added with data- prefix
225+
var tagProperties = ['once', 'skip', 'template']; // Attributes which should be added with data- prefix
224226

225227
var commonDataAttributes = ['body', 'pbody']; // from: https://github.com/kangax/html-minifier/blob/gh-pages/src/htmlminifier.js#L202
226228

@@ -325,22 +327,6 @@ function includes(array, value) {
325327
return array.includes(value);
326328
}
327329

328-
function ensureIsArray(arg, key) {
329-
if (!key || !isObject(arg)) {
330-
return isArray(arg) ? arg : [];
331-
}
332-
333-
if (!isArray(arg[key])) {
334-
arg[key] = [];
335-
}
336-
337-
return arg;
338-
}
339-
function ensuredPush(object, key, el) {
340-
ensureIsArray(object, key);
341-
object[key].push(el);
342-
}
343-
344330
function hasMetaInfo(vm) {
345331
vm = vm || this;
346332
return vm && (vm[rootConfigKey] === true || isObject(vm[rootConfigKey]));
@@ -397,6 +383,8 @@ function createMixin(Vue, options) {
397383

398384
return {
399385
beforeCreate: function beforeCreate() {
386+
var _this2 = this;
387+
400388
var rootKey = '$root';
401389
var $root = this[rootKey];
402390
var $options = this.$options;
@@ -466,7 +454,7 @@ function createMixin(Vue, options) {
466454
// if computed $metaInfo exists, watch it for updates & trigger a refresh
467455
// when it changes (i.e. automatically handle async actions that affect metaInfo)
468456
// credit for this suggestion goes to [Sébastien Chopin](https://github.com/Atinux)
469-
ensuredPush($options, 'created', function () {
457+
this.$on('hook:created', function () {
470458
this.$watch('$metaInfo', function () {
471459
triggerUpdate(options, this[rootKey], 'watcher');
472460
});
@@ -484,7 +472,7 @@ function createMixin(Vue, options) {
484472
if (!$root[rootConfigKey].initialized) {
485473
if (!$root[rootConfigKey].initializedSsr) {
486474
$root[rootConfigKey].initializedSsr = true;
487-
ensuredPush($options, 'beforeMount', function () {
475+
this.$on('hook:beforeMount', function () {
488476
var $root = this; // if this Vue-app was server rendered, set the appId to 'ssr'
489477
// only one SSR app per page is supported
490478

@@ -495,7 +483,7 @@ function createMixin(Vue, options) {
495483
} // we use the mounted hook here as on page load
496484

497485

498-
ensuredPush($options, 'mounted', function () {
486+
this.$on('hook:mounted', function () {
499487
var $root = this[rootKey];
500488

501489
if (!$root[rootConfigKey].initialized) {
@@ -535,8 +523,38 @@ function createMixin(Vue, options) {
535523
addNavGuards($root);
536524
}
537525
}
538-
} // do not trigger refresh on the server side
526+
}
527+
528+
this.$on('hook:destroyed', function () {
529+
var _this = this;
530+
531+
// do not trigger refresh:
532+
// - when user configured to not wait for transitions on destroyed
533+
// - when the component doesnt have a parent
534+
// - doesnt have metaInfo defined
535+
if (!this.$parent || !hasMetaInfo(this)) {
536+
return;
537+
}
539538

539+
delete this._hasMetaInfo;
540+
this.$nextTick(function () {
541+
if (!options.waitOnDestroyed || !_this.$el || !_this.$el.offsetParent) {
542+
triggerUpdate(options, _this.$root, 'destroyed');
543+
return;
544+
} // Wait that element is hidden before refreshing meta tags (to support animations)
545+
546+
547+
var interval = setInterval(function () {
548+
if (_this.$el && _this.$el.offsetParent !== null) {
549+
/* istanbul ignore next line */
550+
return;
551+
}
552+
553+
clearInterval(interval);
554+
triggerUpdate(options, _this.$root, 'destroyed');
555+
}, 50);
556+
});
557+
}); // do not trigger refresh on the server side
540558

541559
if (this.$isServer) {
542560
/* istanbul ignore next */
@@ -545,41 +563,10 @@ function createMixin(Vue, options) {
545563

546564

547565
updateOnLifecycleHook.forEach(function (lifecycleHook) {
548-
ensuredPush($options, lifecycleHook, function () {
566+
_this2.$on("hook:".concat(lifecycleHook), function () {
549567
triggerUpdate(options, this[rootKey], lifecycleHook);
550568
});
551569
});
552-
},
553-
// TODO: move back into beforeCreate when Vue issue is resolved
554-
destroyed: function destroyed() {
555-
var _this = this;
556-
557-
// do not trigger refresh:
558-
// - when user configured to not wait for transitions on destroyed
559-
// - when the component doesnt have a parent
560-
// - doesnt have metaInfo defined
561-
if (!this.$parent || !hasMetaInfo(this)) {
562-
return;
563-
}
564-
565-
delete this._hasMetaInfo;
566-
this.$nextTick(function () {
567-
if (!options.waitOnDestroyed || !_this.$el || !_this.$el.offsetParent) {
568-
triggerUpdate(options, _this.$root, 'destroyed');
569-
return;
570-
} // Wait that element is hidden before refreshing meta tags (to support animations)
571-
572-
573-
var interval = setInterval(function () {
574-
if (_this.$el && _this.$el.offsetParent !== null) {
575-
/* istanbul ignore next line */
576-
return;
577-
}
578-
579-
clearInterval(interval);
580-
triggerUpdate(options, _this.$root, 'destroyed');
581-
}, 50);
582-
});
583570
}
584571
};
585572
}
@@ -617,6 +604,18 @@ function getOptions(options) {
617604
return optionsCopy;
618605
}
619606

607+
function ensureIsArray(arg, key) {
608+
if (!key || !isObject(arg)) {
609+
return isArray(arg) ? arg : [];
610+
}
611+
612+
if (!isArray(arg[key])) {
613+
arg[key] = [];
614+
}
615+
616+
return arg;
617+
}
618+
620619
var serverSequences = [[/&/g, '&amp;'], [/</g, '&lt;'], [/>/g, '&gt;'], [/"/g, '&quot;'], [/'/g, '&#x27;']];
621620
var clientSequences = [[/&/g, "&"], [/</g, "<"], [/>/g, ">"], [/"/g, "\""], [/'/g, "'"]]; // sanitizes potentially dangerous characters
622621

@@ -1196,7 +1195,11 @@ function updateTag(appId, options, type, tags, head, body) {
11961195
}
11971196

11981197
var newElement = document.createElement(type);
1199-
newElement.setAttribute(attribute, appId);
1198+
1199+
if (!tag.once) {
1200+
newElement.setAttribute(attribute, appId);
1201+
}
1202+
12001203
Object.keys(tag).forEach(function (attr) {
12011204
/* istanbul ignore next */
12021205
if (includes(tagProperties, attr)) {

0 commit comments

Comments
 (0)