evermade / wp-block-toolkit

Toolkit for developing WordPress Gutenberg blocks.
https://www.evermade.fi
GNU General Public License v3.0
9 stars 1 forks source link

SortablePostsControl incorrectly returns a function on drag end #8

Closed tnke closed 1 year ago

tnke commented 1 year ago

The onChange callback of SortablePostsControl incorrectly returns a function when sorting, because of these lines: https://github.com/evermade/wp-block-toolkit/blob/main/src/components/SortablePostsControl.js#L191-L196

The current method works fine when using e.g. useState, but not when using setAttributes of WP. The component should always predictably return the array of sorted values.