Commit 5b89d248 authored by Savas Vedova's avatar Savas Vedova

Fix console errors when changing filter

parent cc0bc406
...@@ -7,6 +7,19 @@ export default { ...@@ -7,6 +7,19 @@ export default {
GlPopover, GlPopover,
GlBadge, GlBadge,
}, },
methods: {
/**
* BVPopover retrieves the target during the `beforeDestroy` hook to deregister attached
* events. Since during `beforeDestroy` refs are `undefined`, it throws a warning in the
* console because we're trying to access the `$el` property of `undefined`. Optional
* chaining is not working in templates, which is why the computed property is used.
*
* See more on https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49628#note_464803276
*/
target() {
return this.$refs.badge?.$el;
},
},
}; };
</script> </script>
...@@ -22,7 +35,7 @@ export default { ...@@ -22,7 +35,7 @@ export default {
'The vulnerability is no longer detected. Verify the vulnerability has been fixed or removed before changing its status.', 'The vulnerability is no longer detected. Verify the vulnerability has been fixed or removed before changing its status.',
) )
" "
:target="() => $refs.badge.$el" :target="target"
:title="__('Vulnerability remediated. Review before resolving.')" :title="__('Vulnerability remediated. Review before resolving.')"
placement="top" placement="top"
triggers="hover focus" triggers="hover focus"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment