GX4014: shared signal in a component with no gx.Room prop
A signal with the word shared needs a room, and the component has no prop of type gx.Room for the key of the room.
Cause
A shared signal has one value for each viewer of a room. The key of the room is a server value. A loader makes it with gx.RoomKey and gives it to the component as a prop of type gx.Room.
A component with a shared signal and no such prop has no room.
Example
package notes
signals {
shared Typing bool = false
}
<p show={$Typing}>A viewer writes</p>gx check reports:
notes/Note.gx:4:3: GX4014: the shared signal "Typing" needs a room: the component has no prop of type gx.RoomFix
- Add the prop to the component:
props { Room gx.Room }. - In the loader of the page, make the key:
gx.RoomKey(c, "doc-42"). Give it to the component:<Note room={p.Room} />. - For a value that only one viewer sees, remove the word
shared.