diff --git a/addon/-private/sticky/table-sticky-polyfill.js b/addon/-private/sticky/table-sticky-polyfill.js index f6784fe5f..0ab9bfeda 100644 --- a/addon/-private/sticky/table-sticky-polyfill.js +++ b/addon/-private/sticky/table-sticky-polyfill.js @@ -210,6 +210,6 @@ export function setupTableStickyPolyfill(element) { } export function teardownTableStickyPolyfill(element) { - TABLE_POLYFILL_MAP.get(element).destroy(); + TABLE_POLYFILL_MAP.get(element)?.destroy(); TABLE_POLYFILL_MAP.delete(element); } diff --git a/tests/integration/components/basic-test.js b/tests/integration/components/basic-test.js index 6e952c3c2..0ba61d480 100644 --- a/tests/integration/components/basic-test.js +++ b/tests/integration/components/basic-test.js @@ -399,5 +399,32 @@ module('Integration | basic', function() { document.querySelector('#ember-testing-container').style.height = '600px'; this.set('showComponent', false); }); + + test('Destroying table with footerRows after initial render does not trigger error', async function(assert) { + assert.expect(0); + + this.set('columns', generateColumns(4)); + this.set('rows', generateRows(10)); + + this.set('showComponent', true); + + await render(hbs` + {{#if this.showComponent}} +
+ + + + {{#if this.footerRows}} + + {{/if}} + +
+ {{/if}} + `); + + this.set('footerRows', generateRows(1)); + + this.set('showComponent', false); + }); }); });