ExportXMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Unknown
    • 5.12.0
    • Affects Version/s: None
    • None
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      Query\Grammar::prepareFieldsForQuery() renames a->b to a.b by assigning the new key and unsetting the old one:

      $values[$newKey] = $value;
      unset($values[$key]);
      

      For a sort specification this appends the renamed key, so orderBy('traits->colour')->orderBy('name') is sent as {"name": 1, "traits.colour": 1} and the requested primary sort silently becomes the last tie-breaker. Fix: rebuild the array preserving the original key position (same for the .id to ._id rename). Add a test with two sort keys.

      Filament feature this fixes: sortable columns on embedded-document attributes (TextColumn::make('traits.colour')>sortable()). Filament rewrites the dot path to traits>colour and always appends a secondary default sort, so the user's sort is lost on every such column.

              Assignee:
              Pauline Vos
              Reporter:
              Pauline Vos
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: