Skip to content

fix: handle canonicalized route responses#2995

Merged
nighca merged 1 commit intogoplus:devfrom
aofei:route-canonicalization
Apr 10, 2026
Merged

fix: handle canonicalized route responses#2995
nighca merged 1 commit intogoplus:devfrom
aofei:route-canonicalization

Conversation

@aofei
Copy link
Copy Markdown
Member

@aofei aofei commented Mar 27, 2026

Handle moved-resource responses from the backend without generic write retries, and retry updateProject once with the canonical route so saving existing projects still works after a project rename.

Replace unresolved user, project, and editor routes with canonical backend values after loading so subsequent UI behavior uses canonical identifiers consistently.

Updates #2993

gemini-code-assist[bot]

This comment was marked as outdated.

@xgopilot
Copy link
Copy Markdown
Contributor

xgopilot bot commented Mar 31, 2026

Clean, well-structured fix. The canonical retry logic in updateProject, the useResolvedUser composable, and the project-route.ts utility are all good separations of concern. New unit tests for both Client and updateProject add confidence around the moved-resource edge cases.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds frontend support for backend route canonicalization by (1) surfacing moved-resource conflicts with canonical identifiers and (2) updating UI routes/queries to use canonical user/project identifiers after loading, so subsequent behavior is consistent (e.g., saving after rename).

Changes:

  • Add a 40901 errorResourceMoved API exception path with canonical route metadata support in the API client.
  • Retry updateProject once using the canonical {owner,name} from moved-resource metadata.
  • Canonicalize community user/project routes after resolving from backend, and propagate canonical identifiers into subsequent queries/operations.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
spx-gui/src/utils/project-route.ts Introduces a shared {owner,name} route helper type and comparison/build utilities.
spx-gui/src/pages/editor/index.vue Tracks project route input separately and replaces editor URL with canonical route after load.
spx-gui/src/pages/community/user/resolved-user.ts Adds a small helper to derive canonical username from useUser.
spx-gui/src/pages/community/user/projects.vue Uses resolved canonical username for project listing queries.
spx-gui/src/pages/community/user/overview.vue Uses resolved canonical username for links and list queries.
spx-gui/src/pages/community/user/likes.vue Uses resolved canonical username for liked-project queries.
spx-gui/src/pages/community/user/index.vue Replaces /user/:nameInput route param with canonical username after user resolves.
spx-gui/src/pages/community/user/following.vue Uses resolved canonical username for following list queries.
spx-gui/src/pages/community/user/followers.vue Uses resolved canonical username for followers list queries.
spx-gui/src/pages/community/project.vue Canonicalizes /project/:owner/:name route after project resolves and uses canonical identifiers for actions.
spx-gui/src/apis/project.ts Retries updateProject once with canonical route when backend reports moved resource.
spx-gui/src/apis/project.test.ts Adds tests covering updateProject canonical-route retry behavior.
spx-gui/src/apis/common/exception.ts Adds moved-resource exception code and canonical metadata type guard.
spx-gui/src/apis/common/client.ts Plumbs moved-resource canonical metadata from error payload into ApiException.meta.
spx-gui/src/apis/common/client.test.ts Adds test ensuring moved conflicts are surfaced (no retry) with canonical meta attached.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Collaborator

@nighca nighca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其他我没问题

Handle moved-resource responses from the backend without generic write
retries, and retry updateProject once with the canonical route so
saving existing projects still works after a project rename.

Replace unresolved user, project, and editor routes with canonical
backend values after loading so subsequent UI behavior uses canonical
identifiers consistently.

Updates goplus#2993

Signed-off-by: Aofei Sheng <aofei@aofeisheng.com>
@aofei aofei force-pushed the route-canonicalization branch from 5e58d94 to 0e8e23c Compare April 10, 2026 01:19
@nighca nighca merged commit 380e8e5 into goplus:dev Apr 10, 2026
4 checks passed
@aofei aofei deleted the route-canonicalization branch April 10, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants