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

Caller inputs disconnect on reload if caller serialized above definition #1893

Closed
laurensvalk opened this issue Sep 5, 2023 · 4 comments · Fixed by #1918
Closed

Caller inputs disconnect on reload if caller serialized above definition #1893

laurensvalk opened this issue Sep 5, 2023 · 4 comments · Fixed by #1918
Assignees
Labels
type: bug Something isn't working

Comments

@laurensvalk
Copy link
Contributor

Category

  • Plugins

Component

block-shareable-procedures 3.0.5 with Blockly 10.1.3.

I think this did not occur with Blockly 10, but I have only verified

Describe the bug

Loading a project will disconnect and bump caller inputs if it is serialized above the definition.

I think this might only affect the JSON case where the order is based on appending instead of workspace placement.

To Reproduce

The easiest way is to add block-shareable-procedures to the playground.

Steps:

cd plugins/dev-tools
npm install
npm add "@blockly/block-shareable-procedures"   # Also note versions above just in case

Activate plugin in playground:

diff --git a/plugins/dev-tools/test/index.js b/plugins/dev-tools/test/index.js
index 15c40817..2a0ea1bd 100644
--- a/plugins/dev-tools/test/index.js
+++ b/plugins/dev-tools/test/index.js
@@ -12,6 +12,17 @@
 import * as Blockly from 'blockly';
 import {createPlayground, toolboxCategories} from '../src/index';
 
+const {
+  blocks,
+  unregisterProcedureBlocks,
+  registerProcedureSerializer,
+} = require('@blockly/block-shareable-procedures');
+
+unregisterProcedureBlocks();
+Blockly.common.defineBlocks(blocks);
+
+registerProcedureSerializer();
+
 /**
  * Create a workspace.
  * @param {HTMLElement} blocklyDiv The blockly container div.

See video below for the reproduction steps:

  • Start with any statement block, e.g. repeat.
  • Create a procedure with some arguments.
  • Add a caller to the workspace, attach it to previously mentioned statement. (JSON should now have it above procedure def)
  • Attach some input blocks
  • Press refresh to reload
  • The input block will disconnect

Expected behavior

Not disconnect inputs.

Screenshots

update-2023-09-05_12.25.48.mp4
@laurensvalk laurensvalk added triage type: bug Something isn't working labels Sep 5, 2023
@rachel-fenichel
Copy link
Collaborator

@BeksOmega since this is related to procedures, can you take a look and decide if it's fixable this quarter?

@BeksOmega
Copy link
Contributor

BeksOmega commented Sep 6, 2023

I think this is probably actually #1049. The advanced playground uses XML on reload, which doesn't include the procedure models.

@laurensvalk if you try this with JSON serialization, does it still reproduce? You can create a button in your test page that serializes to and loads back in JSON. [Edit: or just test it in the browser console]

@BeksOmega BeksOmega self-assigned this Sep 6, 2023
@laurensvalk
Copy link
Contributor Author

Thanks @BeksOmega. This appears to happen with JSON serialization too.

I first noticed this in my own application, which does something like #1049 already because I use some features that are not supported by the XML loader.

@BeksOmega BeksOmega changed the title block-shareable-procedures: caller inputs disconnect on reload if caller serialized above definition Caller inputs disconnect on reload if caller serialized above definition Sep 7, 2023
@BeksOmega
Copy link
Contributor

BeksOmega commented Sep 7, 2023

Ah ok, I wasn't seeing the issue reproduce because I was only adding a single parameter to the procedure. Now able to reproduce!

Root caused to #1865 which was fixing #1859

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants