Skip to content

fix(wiki): resolve titles for unloaded backlinks - #3931

Open
hahahahahayesyeseys wants to merge 1 commit into
Tencent:mainfrom
hahahahahayesyeseys:fix/issue-3922-wiki-backlink-title
Open

hahahahahayesyeseys wants to merge 1 commit into
Tencent:mainfrom
hahahahahayesyeseys:fix/issue-3922-wiki-backlink-title

Conversation

@hahahahahayesyeseys

Copy link
Copy Markdown
Contributor

Description

Wiki backlink labels were rendered from the slug whenever the target page had not yet been loaded into the paginated sidebar. This made concept and entity backlinks display identifiers instead of their page titles.

This change:

  • adds a read-only batch endpoint, GET /api/v1/knowledgebase/:kb_id/wiki/page-titles, backed by the existing lightweight ListBySlugs query;
  • resolves all backlinks for the selected page in one request, with stale-response protection during navigation;
  • keeps loaded-page and slug fallbacks for missing targets or lookup failures;
  • adds backend/frontend regression coverage and API documentation.

The endpoint uses /wiki/page-titles because Gin's existing /wiki/pages/*slug catch-all route cannot coexist with a /wiki/pages/titles static route.

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • 📚 Documentation update
  • 🎨 Refactor
  • ⚡ Performance improvement
  • 🧪 Test
  • 🔧 Configuration / Build / CI

Related Issue

Fixes #3922

Testing

  • GOTOOLCHAIN=local /tmp/go1.26.1/bin/go test ./internal/handler ./internal/router -count=1
  • npm test -- src/views/knowledge/wiki/wikiBacklinkTitles.test.ts src/views/knowledge/wiki/wikiDirectoryState.test.ts
  • npm run type-check
  • git diff --check origin/main...HEAD

All focused checks passed. The full frontend suite was also attempted: 1,358 passed, 7 failed, 1 skipped out of 1,366. The failures were environment-related Vite/MCP proxy and file-watcher-limit errors. The full backend repository suite was not run.

Checklist

  • git diff --check origin/main...HEAD passes
  • Changed source files are formatted
  • Targeted tests for the changed packages/components pass
  • Diff-scoped lint passes where applicable (not run; golangci-lint is unavailable in the environment)
  • Full-repository checks were run, or unrelated/environment-dependent failures are documented above
  • Self-reviewed the code
  • Added/updated tests covering the change
  • Updated related documentation (website-docs/ and Swagger annotations)
  • Breaking changes are clearly called out in the description above; none introduced

Screenshots / Recordings

The fix changes backlink text rendering in the Wiki browser. No authenticated live UI instance was available for a screenshot in this environment; the rendering logic is covered by wikiBacklinkTitles.test.ts.

This branch has not been deployed

No deployments
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.

[Bug]: Wiki「被链接」列表显示拼音 slug 而非中文标题(concept/entity 未映射为 title)

1 participant