Fix: Handle unknown components gracefully in ContainerComponents.UnmarshalJSON#497
Open
Wulgaren wants to merge 3 commits into
Open
Fix: Handle unknown components gracefully in ContainerComponents.UnmarshalJSON#497Wulgaren wants to merge 3 commits into
Wulgaren wants to merge 3 commits into
Conversation
Wulgaren
commented
Jan 16, 2026
- Skip unknown components instead of failing when decoding message components
- This allows messages with new Discord component types to still be loaded
- Also added support for newer select component types (UserSelect, RoleSelect, MentionableSelect, ChannelSelect) in ParseComponent
…rshalJSON - Skip unknown components instead of failing when decoding message components - This allows messages with new Discord component types to still be loaded - Also added support for newer select component types (UserSelect, RoleSelect, MentionableSelect, ChannelSelect) in ParseComponent
diamondburned
previously approved these changes
Apr 6, 2026
ayn2op
previously approved these changes
Apr 7, 2026
diamondburned
previously approved these changes
Apr 9, 2026
ayn2op
previously approved these changes
Apr 9, 2026
ayn2op
reviewed
Apr 9, 2026
Comment on lines
+274
to
+278
| // If it's an unknown component, skip it instead of failing | ||
| // This allows messages with new component types to still be loaded | ||
| if _, isUnknown := p.(*UnknownComponent); isUnknown { | ||
| continue | ||
| } |
There was a problem hiding this comment.
isnt that branch is effectively unreachable? since *UnknownComponent implements TopLevelComponent, it is unreachable (!ok != false):
https://github.com/diamondburned/arikawa/pull/497/changes#diff-962d7ae8c081b5ff9c6617afaaf818bdba4b6245bddb2484609030c2e00d4e42R274-R278
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.