fix(webui): support version switching on public share (no login redirect)

Switching a version in the public share breadcrumb navigated to the
authenticated /projects/:id/files/:id route, which triggered the
authenticated /api/projects/:id/team call (via resolveTeamIdFromPath) ->
401 -> redirect to login.

- breadcrumb handleVersionClick now routes to /share/:shareId/files/:id
  with a version search param when public.
- public share route gains a version param; PublicShareManager fetches the
  stack asset (for the version list) and the active version child asset
  (for display/comments/fields), mirroring the authenticated page.
- compare exit sets version to the active side for parity.
This commit is contained in:
yiling
2026-07-04 15:22:38 +08:00
parent c793e0dd78
commit 0bbb846beb
3 changed files with 54 additions and 9 deletions
@@ -3,13 +3,14 @@ import { createFileRoute } from '@tanstack/react-router'
function PublicShareFilePage() {
const { shareId, fileId } = Route.useParams()
const { start, compare, cmpLeft, cmpRight, cmpActive } = Route.useSearch()
const { start, version, compare, cmpLeft, cmpRight, cmpActive } = Route.useSearch()
return (
<PublicShareManager
shareId={shareId}
initialFileId={fileId}
startTime={start}
versionId={version}
compare={compare}
compareLeftId={cmpLeft}
compareRightId={cmpRight}
@@ -23,12 +24,14 @@ export const Route = createFileRoute('/share/$shareId/files/$fileId')({
validateSearch: (search: Record<string, unknown>) => {
return {
start: search.start ? Number(search.start) : undefined,
version: (search.version as string) || undefined,
compare: search.compare === true || search.compare === 'true' || undefined,
cmpLeft: (search.cmpLeft as string) || undefined,
cmpRight: (search.cmpRight as string) || undefined,
cmpActive: search.cmpActive === 'right' ? 'right' : undefined,
} as {
start?: number
version?: string
compare?: boolean
cmpLeft?: string
cmpRight?: string