mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-24 22:50:34 +03:00
Clear Interval if the component doesn't have the $el property
Using the vuelidate plugin creates components that do not have an $el property, but still have _hasMetaInfo set to true, which results in the setInterval never being cleared. There may be other plugins that create similar components. Changing the line to if (this.$el && this.$el.offsetParent !== null) return would resolve this issue.
This commit is contained in:
committed by
GitHub
parent
776ddf62a2
commit
6f2b87c169
@@ -87,7 +87,7 @@ export default function VueMeta (Vue, options = {}) {
|
|||||||
if (this._hasMetaInfo) {
|
if (this._hasMetaInfo) {
|
||||||
// Wait that element is hidden before refreshing meta tags (to support animations)
|
// Wait that element is hidden before refreshing meta tags (to support animations)
|
||||||
const interval = setInterval(() => {
|
const interval = setInterval(() => {
|
||||||
if (this.$el.offsetParent !== null) return
|
if (this.$el && this.$el.offsetParent !== null) return
|
||||||
clearInterval(interval)
|
clearInterval(interval)
|
||||||
batchID = batchUpdate(batchID, () => this.$meta().refresh())
|
batchID = batchUpdate(batchID, () => this.$meta().refresh())
|
||||||
}, 50)
|
}, 50)
|
||||||
|
|||||||
Reference in New Issue
Block a user