<b-table> row-hovered event handler throws error when table removed while hovered
Describe the bug
Since upgrading from v2.0.0-rc.28 to v2.1.0 I've been noticing the following error appearing in the browser console from time to time:
This appears to be the offending line: https://github.com/bootstrap-vue/bootstrap-vue/blob/v2.1.0/src/components/table/helpers/mixin-tbody.js#L27
Steps to reproduce the bug
What I believe is happening is that a row-hovered (or row-unhovered) event is triggered as a user passes his cursor over a
I've been able to - somewhat - consistently reproduce this bug by performing the actions described above (the hover and then route must be done in quick succession obviously).
I don't expect to be seeing console errors or warnings in this case. I just expect the handler to stop gracefully. I'm not sure what the best solution is for this one. Maybe check for the existence of tbody and just bail out if it is undefined?
The text was updated successfully, but these errors were encountered:
No we aren't using
I'll create a codepen when I get a chance to show what I'm talking about. But if I'm right about the cause, reproduction might be a little tricky because it's contingent on the timing of the row hover/unhover and the action that removes the table from the DOM.
…le is removed from dom (fixes #4384)
…le is removed from dom. instantiate row event handlers only when listeners are registered (fixes #4384) (#4388) * fix(b-table, b-table-lite): handle edge case with row events when table is removed from dom (fixes #4384) * Update mixin-tbody.js * Update mixin-tbody-row.js * Update table-tbody-row-events.spec.js * Update table-tbody-row-events.spec.js * Update mixin-tbody-row.js * only emit events if listeners are registered * Update table-tbody-row-events.spec.js * Update mixin-tbody-row.js * Update mixin-tbody.js * Update mixin-tbody.js * Update mixin-tbody-row.js * Update mixin-tbody.js
Hi @jackmu95 ,
I believe I'm seeing a similar issue in IE 11 : -
Do you know when this fix will be available or if there is a workaround ?
@tmorehouse @jackmu95 I've tried with version 2.2.0 and there is still an issue.
It is far far better - it no longer generates thousands of errors while hovering, however as soon as you click or double click a row you then see the issue manifest itself - though with a single error.
TypeError: Object expected