fix: handle null plugin badges#36767
Merged
Merged
Conversation
HanqingZ
approved these changes
May 28, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
HanqingZ
added a commit
to HanqingZ/dify
that referenced
this pull request
May 28, 2026
crazywoola
pushed a commit
that referenced
this pull request
May 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Handle marketplace plugin payloads where
badgesis returned asnullinstead of an array.Root Cause
The plugin card used a destructuring default (
badges = []), which only coversundefined. When the API returnsbadges: null, the component still calls.includes()onnulland can crash rendering.Changes
payload.badges ?? []before checking for the partner badge.badgesfields.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.tsxpnpm exec tsc --noEmit --pretty false --incremental falseNote: root-level
pnpm exec vp test ...failed withCannot find binary path for command 'node'; rerunning from/Users/banana/Work/dify/webpassed. Targeted ESLint on the touched files reports pre-existing lint debt unrelated to this patch.