Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blocks with Mutator-Driven Output Types Fail to Reconnect After Reloading JSON #8692

Open
1 task done
chrisbansart opened this issue Dec 9, 2024 · 0 comments
Open
1 task done
Assignees
Labels
issue: bug Describes why the code or behaviour is wrong

Comments

@chrisbansart
Copy link

Check for duplicates

  • I have searched for similar issues before opening a new one.

Description

I am encountering an issue when connecting a block with an input type check (e.g., "String") to another block that has a mutator with multiple output types (e.g., "Array" and "String").

The connection works correctly when the second block is configured to have the appropriate output type ("String"), and I can successfully save the workspace as JSON. However, when I reload the JSON into the workspace, the two blocks become disconnected.

This issue appears to be related to the combination of type checks and dynamically changing output types managed by the mutator.

I suspect the problem occurs because type checking is performed too early during the loading process. Initially, the second block is interpreted with its default output type (e.g., "Array"), which makes it incompatible with the input type of the first block. As a result, the connection is not re-established even though the mutator could later set the output type to "String."

Reproduction steps

  1. Open the Blockly playground: Blockly Playground.
  2. Add the "Reverse [ ]" block from the Text category (which accepts inputs of type "String").
  3. Add the "Make [list from text] with delimiter [ ]" block from the Lists category (which outputs a value of type "Array").
  4. Use the dropdown menu on the second block to change its mode to "text from list with delimiter [ ]", which modifies its output to type "String".
  5. Connect the output of the second block to the input of the "Reverse" block. The connection works correctly because both input and output types are "String".
  6. Save the workspace as JSON.
  7. Reload the saved JSON into the workspace

Observed Behavior:
Upon reloading the JSON, the blocks are disconnected, despite having been connected correctly before saving.

Expected Behavior:
The blocks should remain connected after reloading, preserving their valid configuration.

Stack trace

No error occurs

Screenshots

  • The two blocks can connect each other because same types :
  • Image
  • I can save the JSON
  • When I load the same JSON, blocks disconnect
    Image

Browsers

No response

@chrisbansart chrisbansart added issue: bug Describes why the code or behaviour is wrong issue: triage Issues awaiting triage by a Blockly team member labels Dec 9, 2024
@cpcallen cpcallen removed the issue: triage Issues awaiting triage by a Blockly team member label Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug Describes why the code or behaviour is wrong
Projects
None yet
Development

No branches or pull requests

3 participants