New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Popover console warnings #735

Closed
wanxe opened this Issue Jul 24, 2017 · 5 comments

Comments

Projects
None yet
3 participants
@wanxe

wanxe commented Jul 24, 2017

When using the popover component and hovering the mouse, the console displays the following error:

[Vue warn]: Error in beforeDestroy hook: "TypeError: this.$data._trigger.className.replace is not a function" found in ---> <BPopover>

@tmorehouse

This comment has been minimized.

Member

tmorehouse commented Jul 24, 2017

Hmmm I wonder if this should be using .classList.add/.classList.remove?

@mosinve

This comment has been minimized.

Member

mosinve commented Jul 24, 2017

i think it goes from lib/mixins/popover.js, line 203

        destroyTether() {
            if (this.$data._tether && !this.showState) {
                this.$data._tether.destroy();
                this.$data._tether = null;
                const regx = new RegExp('(^|[^-]\\b)(' + TETHER_CLASS_PREFIX + '\\S*)', 'g');
here ---->    this.$data._trigger.className = this.$data._trigger.className.replace(regx, '');
            }
        },
@tmorehouse

This comment has been minimized.

Member

tmorehouse commented Jul 24, 2017

Ah, it is using the String.prototype.replace and if this.$data._trigger is possibly undefined (or not a string).

@mosinve

This comment has been minimized.

Member

mosinve commented Jul 24, 2017

is this condition performs as null/undef check if (this.$data._tether && !this.showState) {
ah.... it;s a _tether,not _trigger, so it needs a _trigger undef check

@tmorehouse

This comment has been minimized.

Member

tmorehouse commented Jul 24, 2017

If for some reason the default slot content changes (or gets emptied) before destroyTether() gets called, then, thi.$data._trigger could be null/undefined, or the element may not exist.

tmorehouse added a commit that referenced this issue Jul 25, 2017

fix(popover.js): destroy check for trigger & classes (issue #735)
Addresses issue #735

Prevents console warning:
[Vue warn]: Error in beforeDestroy hook: "TypeError: this.$data._trigger.className.replace is not a function" found in ---> <BPopover>

@tmorehouse tmorehouse added this to the v0.19.0 milestone Jul 25, 2017

@tmorehouse tmorehouse closed this Jul 25, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment