question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add a function "workspace.refresh()"

See original GitHub issue

i was unable to refresh workspace after reinitialize a block by Blockly.Blocks['a'] then i found out that blocks inside workspace don’t update but blocks inside toolbox are updating fine so, we need to refresh workspace after reinitializing a block. As mentioned at https://github.com/google/blockly/issues/3940#issuecomment-640267246

  1. A solution for refreshing workspace

    1. export xml of blocks
    2. clear the workspace
    3. reimport blocks from xml HSgjRh9DEn
  2. A solution to refresh toolbox by using workspace.refreshToolboxSelection() YroRl89Pja

Now we can add a function workspace.refresh() something like

Blockly.Workspace.prototype.refresh = function() {
    var xml = Blockly.Xml.workspaceToDom(this);
    this.clear();
    Blockly.Xml.domToWorkspace(xml, this);
    this.refreshToolboxSelection();
};

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
genemarscommented, Nov 21, 2022

Thanks @BeksOmega for pointing me in the right direction. I just realized I had my workspace variable declared as Workspace instead of WorkspaceSvg and that method wasn’t working when I tried it first. I fixed it and I am now using Blockly.svgResize and it works as expected.

0reactions
BeksOmegacommented, Nov 21, 2022

Hello @genemars ! This issue is slightly different from resizing the workspace. The person in this issue wanted all of the blocks on the workspace to update when they modified the block definition, which we do not generally want to support.

However, if you want to resize the workspace that is definitely supported. You can call Blockly.svgResize(myWorkspace). I hope that helps!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it possible to refresh the Google Workspace Add-on sidebar ...
I have a Google Workspace Add-on, I want to update the sidebar card everytime there's a new sheet. Below is my code: function...
Read more >
Is it possible to programatically refresh a Workspace Add-On
A google workspace add-on has a Refresh menu option. I would like to do the same thing programmatically. The challenge I am finding...
Read more >
How can you reload the form in an agent workspace
and I have tried using reloadWindow(window); as well as location. reload() and g_form. save() and g_form.
Read more >
refreshTab() for Lightning Experience - Salesforce Developers
Refreshes a workspace tab or a subtab specified by tabId. ... or workspace is refreshed. Save: Changes are saved and then the tab...
Read more >
MATLAB assignin - MathWorks
Update Base Workspace Variable from Function. In a file in your current working folder, create a function that adds two numbers and then...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found