Files
filament/tests
604038fd2b [4.x] Fix: preserve the order of rich editor mention options (#20531)
* fix(forms): preserve the order of rich editor mention options

Mention options were sent to JavaScript as an object keyed by ID, and
`toItemsArray()` reads them back with `Object.entries()`. JavaScript orders
integer-like keys ascending numerically, so for models with numeric primary
keys the developer's ordering was silently replaced with an ascending-ID
sort, for both `items()` and `getSearchResultsUsing()`.

Items are now sent as an ordered list of `id` and `label` pairs. The JS
already supports that shape, so no JS change is required.

This also fixes a related edge case: PHP re-casts numeric-string array keys
back to integers, so a provider whose IDs were 0-based and sequential
serialised to a JSON array of bare labels, and the inserted mention took its
label as its `id`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011LniPBty6yFENqFFcMcNad

* fix(forms): preserve zero-valued mention IDs

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Dan Harrin <git@danharrin.com>
2026-09-20 19:31:08 +01:00
..
2026-06-17 12:13:25 +01:00
2024-06-13 07:13:46 +01:00