vtadmin: fix tab navigation URL corruption in splat routes#20410
vtadmin: fix tab navigation URL corruption in splat routes#20410yushuqin wants to merge 1 commit into
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
There was a problem hiding this comment.
Pull request overview
Fixes a vtadmin regression introduced during the react-router v5→v7 migration where tab navigation inside splat (/*) routes resolves relative to the full matched URL (including the splat portion), causing tabs to append extra path segments and corrupt the destination URL. The PR addresses this by switching Tab to targets from relative paths to absolute, param-constructed paths for affected route components.
Changes:
- Update Workflow page tabs to use absolute
/workflow/:clusterID/:keyspace/:name/...URLs. - Update Tablet, Keyspace, and Shard page tabs to use absolute
/tablet/...and/keyspace/...URLs. - Update Stream page tabs to use absolute stream-detail URLs under
/workflow/.../stream/....
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| web/vtadmin/src/components/routes/workflow/Workflow.tsx | Converts workflow tab links from relative to absolute URLs to avoid splat-relative corruption. |
| web/vtadmin/src/components/routes/tablet/Tablet.tsx | Converts tablet tab links (including Advanced) to absolute URLs under /tablet/.... |
| web/vtadmin/src/components/routes/stream/Stream.tsx | Converts stream tab links to absolute URLs matching the stream splat route. |
| web/vtadmin/src/components/routes/shard/Shard.tsx | Converts shard tab links to absolute URLs under /keyspace/.../shard/.... |
| web/vtadmin/src/components/routes/keyspace/Keyspace.tsx | Converts keyspace tab links (including Advanced) to absolute URLs under /keyspace/.... |
mattlord
left a comment
There was a problem hiding this comment.
This LGTM. I will approve, but while we wait for the second reviewer... it would be great if we could also add a small MemoryRouter test for one representative splat route would help prevent this from regressing again.
Thanks, @yushuqin !
05f801d to
18a3238
Compare
After the react-router v5→v7 migration (PR vitessio#19615), relative paths in Tab NavLinks resolve against the full URL (including the splat portion) rather than the route definition path. This causes tab clicks to append path segments, producing corrupted URLs like: /keyspace/cluster/ks/shards/vschema/json/json_tree/vschema/shards Fix by using absolute paths constructed from route params in all Tab components within splat routes (Keyspace, Tablet, Shard, Stream, Workflow). Signed-off-by: yqin <yqin@slack-corp.com> Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
18a3238 to
3bb69b8
Compare
Description
Fixes #20411
After the react-router v5→v7 migration (#19615), relative paths in Tab NavLinks resolve against the full URL (including the splat portion) rather than the route definition path. This causes tab clicks to append path segments, producing corrupted URLs like:
Instead of the expected:
Root Cause
In react-router v7, relative links within splat routes (
/*) resolve relative to the full matched URL. The migration changed:to:
Fix
Use absolute paths constructed from route params in all Tab components within splat routes:
Affected pages
Related Issue(s)
Fixes #20411
Regression from #19615
Testing
Deployed to staging and verified tab navigation works correctly on all affected pages.
Co-Authored-By: Claude svc-devxp-claude@slack-corp.com