Skip to content

Commit bba18ce

Browse files
chrislofloehopper
authored andcommitted
Fix proptype validation warning in SpriteList
We've seen a PropType warning for this prop in development. It seems that when the SpriteList component is used to manage the costumes in the left hand side of the Costumes tab, numeric identifiers are used for `sprite`. When the SpriteList is used in the sprite selection area under the stage, strings are used. There's probably a way of fixing this at source, but for now being a bit more permissive with the validation removes the warning. As far as I can tell from reading the source, we use this id for comparison with the `===` operator, so I think numbers or strings are functionally equivalent.
1 parent fa974ec commit bba18ce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/components/sprite-selector/sprite-list.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ SpriteList.propTypes = {
111111
hoveredTarget: PropTypes.shape({
112112
hoveredSprite: PropTypes.string,
113113
receivedBlocks: PropTypes.bool,
114-
sprite: PropTypes.string
114+
sprite: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
115115
}),
116116
items: PropTypes.arrayOf(PropTypes.shape({
117117
costume: PropTypes.shape({

0 commit comments

Comments
 (0)