Skip to content
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

Warnings on Missing Target in Tooltip Component #5598

Closed
Remigius2011 opened this issue Jul 22, 2020 · 2 comments · Fixed by #5763
Closed

Warnings on Missing Target in Tooltip Component #5598

Remigius2011 opened this issue Jul 22, 2020 · 2 comments · Fixed by #5763

Comments

@Remigius2011
Copy link

Remigius2011 commented Jul 22, 2020

Is your feature request related to a problem? Please describe...

When a tooltip does not find its target element, the following warning is issued:

[BootstrapVue warn]: tooltip - Unable to find target element in document.

Firstly, it is hardly possible to find the target element in question because the target element id, which is available at the code location there the warning is issued, is not added to the message. Secondly, these warnings are issued even in production builds, which is imo superfluous, as this does not cause any harm.

Describe the solution you'd like

  1. Please add the target element ID to the warning message to make it easier to find the missing target element, respectively the tooltip in question
  2. Please add a way to suppress these warnings in production builds - by observing the environment variable NODE_ENV and/or by providing a configuration parameter

Describe alternatives you've considered

  • no alternatives available -

Additional context

https://cli.vuejs.org/guide/mode-and-env.html#using-env-variables-in-client-side-code

@Hiws
Copy link
Member

Hiws commented Jul 22, 2020

You should be able to disable the warning in your production build by configuring this variable.
https://bootstrap-vue.org/docs/reference/settings#disabling-bootstrapvue-console-warnings

@Remigius2011
Copy link
Author

Remigius2011 commented Jul 23, 2020

@Hiws, Thank you for the information. Unfortunately, this does not have any observable effect in my case (i.e. the warnings are still issued) - neither when setting it at build time nor at runtime. If it worked, this would be a solution for 2. - even if it might be better to disable warnings in a more selective way. For now, I have implemented a brute-force wrapper for console.warn as follows:

const originalWarn = console.warn
const wrappedWarn = function () {
  if (util.mode.isExperimental() || arguments[0] !== '[BootstrapVue warn]: tooltip - Unable to find target element in document.') {
    return originalWarn(...arguments)
  }
}
console.warn = wrappedWarn

as warnings arise very infrequently, this will not have a major impact on runtime performance.

@jacobmllr95 jacobmllr95 added this to To do in v2.17.0 via automation Sep 11, 2020
v2.17.0 automation moved this from To do to Done Sep 11, 2020
jacobmllr95 added a commit that referenced this issue Sep 11, 2020
…#5763)

* fix: don't display BootstrapVue warning messages when in production

* Update bv-tooltip.js

* Update README.md

* Update bv-tooltip.js

* Update bv-tooltip.js

* Update pagination.js

* Update tooltip.spec.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
v2.17.0
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants