[iris] Encode jobs tab filter/sort/page state in URL query params#4633
[iris] Encode jobs tab filter/sort/page state in URL query params#4633
Conversation
Hydrate page, sortField, sortDir, nameFilter, and stateFilter from route.query on load and write non-default values back via router.replace on change. Follows the existing ThreadDump.vue pattern. This makes the browser back button restore prior filter state and lets copied URLs reproduce the same jobs view. Fixes #4632 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4190ab781d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const nameFilter = ref((route.query.name as string) ?? '') | ||
| const localFilter = ref((route.query.name as string) ?? '') | ||
| const stateFilter = ref((route.query.state as string) ?? '') |
There was a problem hiding this comment.
Normalize query filter params before storing in refs
route.query.name and route.query.state can be arrays when a URL has repeated params (for example ?name=a&name=b), but these lines cast them directly to string and store them in nameFilter/localFilter/stateFilter. In that case the refs hold arrays at runtime, so the filter controls and ListJobs request body can receive non-string values, producing incorrect filtering (or request validation failures) from a shareable URL. Parse these query values like sort/dir/page (e.g., accept only a single string and otherwise fall back to '').
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
@claude Can you encode these in a better format? It doesn't matter if it's super readable as long as it's shareable and back button friendly
There was a problem hiding this comment.
Claude finished @Helw150's task in 8m 21s —— View job
Normalize URL query params to handle array values safely
- Read current implementation
- Design better encoding format
- Implement changes
- Run pre-commit and tests
- Push changes
Added a queryStr() helper that safely normalizes Vue Router query values (string | string[] | null) to a single string. When a URL has repeated params (e.g. ?name=a&name=b), Vue Router returns an array — the old code cast these directly to string, which would silently pass arrays into the filter refs and RPC requests.
Changes:
- New
queryStr(v)— takesstring | string[] | null | undefined, returns first element if array, or''for null/undefined - All
route.query.*reads now go throughqueryStr()before being passed toparseSort/parseDir/parsePageor stored directly - Tightened parse function signatures from
unknowntostringsincequeryStrguarantees a string
Testing: ./infra/pre-commit.py --all-files --fix passes. 1594/1596 iris tests pass (2 pre-existing failures unrelated to this change: a Playwright locator test and a flaky timeout test). No frontend-specific test suite exists for the dashboard.
Vue Router query values can be string | string[] | null when a URL has repeated params (e.g. ?name=a&name=b). Add a queryStr() helper that always extracts a single string, falling back to '' for arrays/null. Tightens parse function signatures from unknown to string. Co-authored-by: William Held <Helw150@users.noreply.github.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Hydrate page, sortField, sortDir, nameFilter, and stateFilter from route.query
on mount and write non-default values back via router.replace on change. Follows
the existing ThreadDump.vue pattern so the browser back button restores prior
filter state and copied dashboard URLs reproduce the same jobs view.
Fixes #4632