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

Flyout.show changes flyout definition. #4443

Closed
alschmiedt opened this issue Nov 10, 2020 · 0 comments · Fixed by #6913
Closed

Flyout.show changes flyout definition. #4443

alschmiedt opened this issue Nov 10, 2020 · 0 comments · Fixed by #6913
Assignees
Labels
component: toolbox/flyout issue: bug Describes why the code or behaviour is wrong

Comments

@alschmiedt
Copy link
Contributor

alschmiedt commented Nov 10, 2020

Describe the bug
When flyout.show() is given a custom category it changes the original toolbox tree found on workspace.options.languageTree.

To Reproduce

  1. Create a toolbox with the following definition:
var jsonToolbox = {
  "kind": "flyoutToolbox",
  "contents": [
    {
      "kind": "block",
      "type": "controls_if"
    },
    {
      "kind": "category",
      "custom": "VARIABLE"
    }
  ]
}
  1. Run Blockly.getMainWorkspace().options.languageTree in the console.
  2. Notice how the new toolbox definition now has a button instead of a custom category:
var jsonToolbox = {
 "kind": "flyoutToolbox",
 "contents": [
   {
     "kind": "block",
     "type": "controls_if"
   },
   {
     "kind": "button",
     "callback": "CREATE_VARIABLE"
   }
 ]
}

Expected behavior
The toolbox definition should still have a custom category.

Additional context
This bug is frustrating when creating a simple flyout with a custom category. In this case a user needs to be able to refresh their flyout when the contents in the custom category have changed. They should be able to do this by calling:
workspace.getFlyout().show(workspace.options.languageTree)
However, this doesn't work because the custom category has been replaced by the button so the flyout will not update.

@alschmiedt alschmiedt added issue: bug Describes why the code or behaviour is wrong component: toolbox/flyout labels Nov 10, 2020
@rachel-fenichel rachel-fenichel added this to the Bug Bash Backlog milestone Nov 18, 2020
@BeksOmega BeksOmega self-assigned this Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: toolbox/flyout issue: bug Describes why the code or behaviour is wrong
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants