ryangjchandler / filament-navigation

Build structured navigation menus in Filament.
MIT License
168 stars 64 forks source link

Ordering issues with associative array #105

Open Voltra opened 10 months ago

Voltra commented 10 months ago

Fix ordering issues by using regular arrays instead of associative arrays. Existing code should work as is, thanks to PHP handling both kinds of arrays the same way.

This is a proposition of fix that highlights a problem: There's an issue with sorting.

Sorting is always correct when done in the create/edit view. But once saved and reloaded, the items were sorted by UUID (i.e. by array keys) instead of keeping their manually attributed order.

Voltra commented 10 months ago

My guess is that since JSON objects are unordered sets of name/value pairs, there's no guarantee it'll keep ordering across systems (e.g. PHP-level serde, DB-level serde)