Skip to content

fix: handle null plugin badges#36767

Merged
HanqingZ merged 1 commit into
mainfrom
codex/handle-null-plugin-badges
May 28, 2026
Merged

fix: handle null plugin badges#36767
HanqingZ merged 1 commit into
mainfrom
codex/handle-null-plugin-badges

Conversation

@crazywoola
Copy link
Copy Markdown
Member

Summary

Handle marketplace plugin payloads where badges is returned as null instead of an array.

Root Cause

The plugin card used a destructuring default (badges = []), which only covers undefined. When the API returns badges: null, the component still calls .includes() on null and can crash rendering.

Changes

  • Normalize payload.badges ?? [] before checking for the partner badge.
  • Update marketplace plugin types to allow nullable badges fields.
  • Add a regression test for badges: null.

Validation

  • pnpm exec vp test app/components/plugins/card/__tests__/index.spec.tsx -t "null badges"
  • pnpm exec vp test app/components/plugins/card/__tests__/index.spec.tsx
  • pnpm exec tsc --noEmit --pretty false --incremental false

Note: root-level pnpm exec vp test ... failed with Cannot find binary path for command 'node'; rerunning from /Users/banana/Work/dify/web passed. Targeted ESLint on the touched files reports pre-existing lint debt unrelated to this patch.

@crazywoola crazywoola changed the title [codex] handle null plugin badges fix: handle null plugin badges May 28, 2026
@github-actions github-actions Bot added the web This relates to changes on the web. label May 28, 2026
@crazywoola crazywoola marked this pull request as ready for review May 28, 2026 06:54
@crazywoola crazywoola requested review from iamjoel and zhsama as code owners May 28, 2026 06:54
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. javascript labels May 28, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label May 28, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.87%. Comparing base (57b02e3) to head (b009cdb).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #36767   +/-   ##
=======================================
  Coverage   85.87%   85.87%           
=======================================
  Files        4538     4538           
  Lines      220780   220781    +1     
  Branches    40681    40681           
=======================================
+ Hits       189588   189595    +7     
+ Misses      27622    27616    -6     
  Partials     3570     3570           
Flag Coverage Δ
dify-ui 95.57% <ø> (ø)
web 86.46% <100.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

@HanqingZ HanqingZ enabled auto-merge May 28, 2026 06:58
@HanqingZ HanqingZ added this pull request to the merge queue May 28, 2026
Merged via the queue into main with commit 91c1d3a May 28, 2026
36 of 37 checks passed
@HanqingZ HanqingZ deleted the codex/handle-null-plugin-badges branch May 28, 2026 07:08
HanqingZ added a commit to HanqingZ/dify that referenced this pull request May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants