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
- Install/activate the AI plugin with AI request logging enabled.
- Generate at least one log entry so the table has data.
- Open AI Request Logs in wp-admin.
- Open the column header menu on any column (e.g. Provider).
- Choose Move left or Move right.
- Observe that column order does not change.
- Repeat on another column—order remains the default.
Screenshots, screen recording, code snippet
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except the AI plugin.
Please confirm which theme type you used for testing.
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
Screenshots, screen recording, code snippet
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except the AI plugin.
Please confirm which theme type you used for testing.