Skip to content

startHats filter by a menu that acceptReporters #4128

Open
@zjn0505

Description

@zjn0505

Expected Behavior

To trigger this Event block

{
   opcode: 'whenArrived',
   blockType: BlockType.EVENT,
   text: 'When robot arrive [LOCATION]',
   func: 'whenArrived',
   arguments: {
      LOCATION: {
         type: ArgumentType.STRING,
         defaultValue: "location",
         menu: 'LOCATION',
      }
   },
   isEdgeActivated: false,
}

I am calling this runtime.startHats("robot_whenArrived", { LOCATION: location }, target);

I expect that the menu can acceptReporters and startHats will still works with reporter block as arguments.

Actual Behavior

Only blocks with items selected from menu can be triggered by startHats.

image

It cannot take reporters as arguments.

image

Steps to Reproduce

Using reporter as argument will make hatFields[matchField] undefined in this check

// Match any requested fields.
// For example: ensures that broadcasts match.
// This needs to happen before the block is evaluated
// (i.e., before the predicate can be run) because "broadcast and wait"
// needs to have a precise collection of started threads.
for (const matchField in optMatchFields) {
if (hatFields[matchField].value !== optMatchFields[matchField]) {
// Field mismatch.
return;
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions