Closed joelamb closed 1 year ago
Latest commit: 4dbf6682b4b85d27e57821c68a82b376256121e1
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
GH Env: preview docs: https://30782fc8.ember-headless-table.pages.dev api docs: https://30782fc8.ember-headless-table.pages.dev/api/modules.html
Turns out that this: https://github.com/CrowdStrike/ember-headless-table/pull/211#discussion_r1283447227 came back to bite us! The test was passing, but waiting in the test-helper was masking the resizing behaviour and causing unpredictable column resizing when interacting with tables.
What was happening: Calling the resize function via a
requestAnimationFrame
in thequeueUpdate
pushes it into the next animation frame, however, the call to save the preferences was then happening ahead of it, so the saved values did not reflect the resizing.We'd created a pseudo-async sequence.
How these changes fix it: So, to ensure that preferences are saved after we have completed resizing, we pass the save function as a callback to the queueUpdate that can then be called in the requestAnimationFrame callback after the resize function.
Because the requestAnimationFrame hides these function call from he ember test waiter, we ensure that we track them by also cancelling the waiter in the requestAnimationFrame callback function.