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

blockly copy failed when use function setting to create new variables. #8659

Open
1 task done
HarwordLiu opened this issue Nov 14, 2024 · 3 comments
Open
1 task done
Labels
issue: bug Describes why the code or behaviour is wrong

Comments

@HarwordLiu
Copy link

HarwordLiu commented Nov 14, 2024

Check for duplicates

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

Description

As you can see, I set the new variable in the blockly function. When I select a variable and copy it (cmd+c, cmd+v), the bug occurs.

blockly version: 11.1.1

Image

Reproduction steps

  1. open playground
  2. drop a procedure declaration block on to the workspace.
  3. click setting button and add a new "input name" block to the "inputs" block.
  4. select the new "input name" block.
  5. Press cmd+c to copy the input block
  6. Press cmd+v to paste the copied block. Observe that nothing is pasted, and the following stack trace appears in the console.
  7. Press cmd-v again. Observe that the copied block is pasted on the main workspace.

Stack trace

procedures.ts:710 Uncaught TypeError: Cannot read properties of null (reading 'getVariable')
    at FieldTextInput.validator_ (procedures.ts:710:25)
    at FieldTextInput.setValue (field.ts:1108:52)
    at FieldTextInput.loadState (field.ts:462:10)
    at loadFields (blocks.ts:696:11)
    at appendPrivate (blocks.ts:488:3)
    at appendInternal (blocks.ts:425:13)
    at append (blocks.ts:379:17)
    at BlockPaster.paste (block_paster.ts:47:15)
    at pasteFromData (clipboard.ts:91:7)
    at Module.paste (clipboard.ts:72:10)
validator_ @ procedures.ts:710
setValue @ field.ts:1108
loadState @ field.ts:462
loadFields @ blocks.ts:696
appendPrivate @ blocks.ts:488
appendInternal @ blocks.ts:425
append @ blocks.ts:379
paste @ block_paster.ts:47
pasteFromData @ clipboard.ts:91
paste @ clipboard.ts:72
callback @ shortcut_items.ts:239
onKeyDown @ shortcut_registry.ts:257
onKeyDown @ inject.ts:309
wrapFunc @ browser_events.ts:69

Screenshots

Image

Browsers

No response

@HarwordLiu HarwordLiu added issue: bug Describes why the code or behaviour is wrong issue: triage Issues awaiting triage by a Blockly team member labels Nov 14, 2024
@cpcallen
Copy link
Contributor

I've revised the reproduction steps. There seem to be at least three separate problems:

  1. It does not appear to be possible to paste a component block (like the "input name" block) into the mutator flyout workspace.
  2. It is possible (but should not be) to paste a component block into the main workspace.
  3. Pasting the component block on the main workspace fails on the first try (but succeeds subsequently).

Item 3 might go away once items 1 and 2 are fixed.

@cpcallen cpcallen removed the issue: triage Issues awaiting triage by a Blockly team member label Nov 15, 2024
@rachel-fenichel
Copy link
Collaborator

@johnnesky for your perusal when next looking for an issue.

@HarwordLiu
Copy link
Author

@cpcallen

Thank you for your reply.

I totally agree with you that in this case the "paste a component block" should be avoided when selecting a variable block.

Now for me, I just disable "procedures_mutatorarg" type block to copy. I don't known it's a good solution for this case, but for now and me, maybe there's no other way.

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