Skip to content

Commit 40b5e76

Browse files
committed
fix list
1 parent e4a8486 commit 40b5e76

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/components/monitor/list-monitor.jsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,10 @@ ListMonitor.propTypes = {
6464
onActivate: PropTypes.func,
6565
onAdd: PropTypes.func,
6666
onResizeMouseDown: PropTypes.func,
67-
value: PropTypes.oneOfType([
67+
value: PropTypes.arrayOf(PropTypes.oneOfType([
6868
PropTypes.string,
69-
PropTypes.number,
70-
PropTypes.arrayOf(PropTypes.oneOfType([
71-
PropTypes.string,
72-
PropTypes.number
73-
]))
74-
]),
69+
PropTypes.number
70+
])),
7571
width: PropTypes.number
7672
};
7773

src/lib/monitor-adapter.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,14 @@ export default function ({id, spriteName, opcode, params, value, vm}) {
4848
}
4949
}
5050

51+
const isListMonitor = opcode === 'data_listcontents';
52+
if (isListMonitor && !Array.isArray(value)) {
53+
if (typeof value === 'string' || typeof value === 'number') {
54+
value = [value];
55+
} else {
56+
value = [];
57+
}
58+
}
59+
5160
return {id, label, category, value};
5261
}

translations/messages/node_modules/scratch-paint/src/lib/messages.json

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)