Skip to content

AI Request Logs: column “move left / move right” has no effect #667

Description

@alexWinterjuice

Description

On AI Request Logs, each table column header exposes DataViews controls to move the column left or right. Using those options does not change column order—the layout always snaps back to the default order.

Expected Result

After “move left” or “move right”, columns stay in the new order (at least for the current session).

Actual Result

Column order never changes from the default: Time → Operation → Provider → Tokens → Duration → Status.

Cause

In src/admin/ai-request-logs/components/LogsTable.tsx, onChangeView runs sortFieldsByCanonicalOrder() on every view update. That re-sorts view.fields back to DEFAULT_VIEW_FIELDS, undoing DataViews’ reordering immediately after the user moves a column.

Suggested fix

Persist nextView.fields as-is when the user reorders columns; only apply canonical ordering when initializing or when normalizing visibility, not on every onChangeView. Optionally persist column order in localStorage (filters/search already persist via logsQuery).

Step-by-step reproduction instructions

  1. Install/activate the AI plugin with AI request logging enabled.
  2. Generate at least one log entry so the table has data.
  3. Open AI Request Logs in wp-admin.
  4. Open the column header menu on any column (e.g. Provider).
  5. Choose Move left or Move right.
  6. Observe that column order does not change.
  7. Repeat on another column—order remains the default.

Screenshots, screen recording, code snippet

Image

Environment info

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except the AI plugin.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Type] BugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions