scratchfoundation / scratch-gui

Graphical User Interface for creating and running Scratch 3.0 projects.
https://scratchfoundation.github.io/scratch-gui/develop/
BSD 3-Clause "New" or "Revised" License
4.46k stars 3.56k forks source link

Variables By Id introduces warning related to variable/list monitors #1298

Open kchadha opened 6 years ago

kchadha commented 6 years ago

Creating a new variable or list (with the variables by id work in scratch-blocks) issues the following warnings (respectively) in the console. These are non-fatal.

raven.js:55 Warning: Failed prop type: Invalid prop `value` of type `number` supplied to `MonitorComponent`, expected `string`.

raven.js:55 Warning: Failed prop type: Invalid prop `monitors` of type `OrderedMap` supplied to `MonitorList`, expected instance of `OrderedMap`.

I assume this is coming from the last line of the following block of code in monitor.jsx:

MonitorComponent.propTypes = {
    category: PropTypes.oneOf(Object.keys(categories)),
    componentRef: PropTypes.func.isRequired,
    label: PropTypes.string.isRequired,
    onDragEnd: PropTypes.func.isRequired,
    value: PropTypes.string.isRequired
};
kchadha commented 6 years ago

Updates: the second warning listed above is created regardless of whether a scalar variable or list is being created, and after talking to @fsih, it seems that these warnings (or at least the one about the OrderedMap) have been around for a while, and were not created because of https://github.com/LLK/scratch-blocks/pull/1350.

Topppy commented 5 years ago

the second warning。 Version of "immutable" package in scratch-gui is "3.8.2", while version of "immutable" is "3.8.1" in “scratch-vm” package. Monitors data is parsed by vm.loadProject which use "OrderedMap" of "3.8.1". while in monitor-list.jsx

 monitors: PropTypes.instanceOf(OrderedMap), 

use "OrderedMap" of "3.8.2". They are not the same "OrderedMap", monitors instanceof OrderedMap will returnfalse.

how to fix? make sure that version of immutable in scratch-ui/package.json and scratch-vm/package.json are equal. we can change scratch-gui/package.json:

"immutable": "3.8.1",