iTwin / iTwinUI-react

A react component library for iTwinUI.
https://github.com/iTwin/iTwinUI
Other
83 stars 23 forks source link

fix(Table): Reset `columnOrder` when `columns` changes #983

Closed r100-stack closed 1 year ago

r100-stack commented 1 year ago

Closes #900

When new columns array contents are passed, the old/stale columnOrder is still used. This could cause unintended column ordering as described in #900.

To fix this, this PR resets the columnOrder to [] whenever the columns array contents change.

Checklist

r100-stack commented 1 year ago

Have you tested user example with this new code? [Add user provided example to one of our test apps and see if this update helps with their issue]

Yes, I tested it by adding the code from the sandbox to the Vite Playground. I added it in the commits near https://github.com/iTwin/iTwinUI-react/pull/983/commits/a86264e3ce19956012c4f6b550b425a405a98324 and removed it after testing that it worked.