fix: handle canonicalized route responses#2995
Conversation
c66ba77 to
2160f00
Compare
|
Clean, well-structured fix. The canonical retry logic in |
There was a problem hiding this comment.
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 errorResourceMovedAPI exception path with canonical route metadata support in the API client. - Retry
updateProjectonce 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.
2160f00 to
b9ffc6d
Compare
b9ffc6d to
35651eb
Compare
35651eb to
57ebe1d
Compare
57ebe1d to
0fdcd01
Compare
0fdcd01 to
fcd9290
Compare
fcd9290 to
d646568
Compare
d646568 to
083ea6e
Compare
083ea6e to
8465600
Compare
8465600 to
3963c53
Compare
3963c53 to
60e3ab2
Compare
60e3ab2 to
b486912
Compare
b486912 to
5e58d94
Compare
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>
5e58d94 to
0e8e23c
Compare
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