Skip to content

Switch icon service to new endpoint and adapt response schema - #234

Merged
hustcc merged 3 commits into
mainfrom
copilot/update-icon-service-url
Apr 15, 2026
Merged

hustcc merged 3 commits into
mainfrom
copilot/update-icon-service-url

Conversation

Copilot AI commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Migrates the icon search service from https://www.weavefox.cn/api/open/v1/icon to https://lab.weavefox.cn/api/v1/infographic/icon. The new endpoint returns a flatter response structure — data is now a top-level array and the outer success flag is success (boolean) instead of status.

Changes

  • src/constants/service.ts — update ICON_SERVICE_URL
  • src/resource/loaders/search.ts — fix response parsing: result?.status → result?.success, result.data.data[0] → result.data[0]
  • site/src/components/IconPage/index.tsx — update all three URL references (fetch call, endpointUrl memo, JSX display), fix parsing (result.data.data → result.data, guard on result.success), and update the displayed response example
- if (result.status && result.data && result.data.success) {
-   setIcons(result.data.data);
+ if (result.success && Array.isArray(result.data)) {
+   setIcons(result.data);

Response schema before → after:

// before
{ "status": true, "message": "success", "data": { "success": true, "data": ["..."] } }

// after
{ "success": true, "data": ["..."], "message": "success" }
@hustcc

hustcc commented Apr 15, 2026

Copy link
Copy Markdown
Member

@Aarebecca 服务迁移,正好改了一下架构,去掉了冗余的 data.data 接口返回结构。

@hustcc
hustcc marked this pull request as ready for review April 15, 2026 03:32
@hustcc

hustcc commented Apr 15, 2026

Copy link
Copy Markdown
Member

@copilot ci 报错,帮我看看,是不是有哪些地方没有修改全。

https://github.com/antvis/Infographic/actions/runs/24434747851/job/71387207750?pr=234

Copilot AI commented Apr 15, 2026

Copy link
Copy Markdown
Contributor Author

@copilot ci 报错,帮我看看,是不是有哪些地方没有修改全。

https://github.com/antvis/Infographic/actions/runs/24434747851/job/71387207750?pr=234

The SSR test mock in __tests__/unit/ssr/examples.test.ts was still matching the old URL pattern (/api/open/v1/icon) and returning the old nested response structure ({ status, data: { data: [...] } }). Updated it in commit 128477d to match /infographic/icon and return { success: true, data: [...] } to align with the new endpoint.

Copilot AI requested a review from hustcc April 15, 2026 03:49
@codecov-commenter

codecov-commenter commented Apr 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.85%. Comparing base (59a231f) to head (128477d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #234   +/-   ##
=======================================
  Coverage   46.85%   46.85%           
=======================================
  Files         342      342           
  Lines       28416    28416           
  Branches     2400     2400           
=======================================
  Hits        13315    13315           
  Misses      15088    15088           
  Partials       13       13           
Flag Coverage Δ
infographic 46.85% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/constants/service.ts 100.00% <100.00%> (ø)
src/resource/loaders/search.ts 54.34% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
@hustcc
hustcc merged commit 6b0c9b1 into main Apr 15, 2026
3 checks passed
@hustcc
hustcc deleted the copilot/update-icon-service-url branch April 15, 2026 04:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants