8000 refactor!: Finish refactor of `WorkspaceSvg` `VariableMap` methods by cpcallen · Pull Request #8946 · google/blockly · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

refactor!: Finish refactor of WorkspaceSvg VariableMap methods #8946

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

Merged
merged 11 commits into from
May 2, 2025

Conversation

cpcallen
Copy link
Contributor
@cpcallen cpcallen commented Apr 30, 2025

The basics

The details

Resolves

Fixes closure compiler warnings for calls to deprecated methods.

Part of #8945.

Proposed Changes

Delete the following methods from WorkspaceSvg:

  • renameVariableById
  • deleteVariableById
  • createVariable

Modify the following methods on VariableMap to call this.workspace.refreshToolboxSelection() if this.workspace is a WorkspaceSvg, replicating the behaviour of the aforementioned deleted methods and additionally ensuring that that method is called following any change to the variable map:

  • renameVariable
  • changeVariableType
  • renameVariableAndUses
  • createVariable
  • addVariable
  • deleteVariable

Additionally, refactor remaining calls to deprecated Workspace variable methods in core/, and improve consistency of use of @deprecated JSDoc tag.

Reason for Changes

PR #8401 deprecated certain …ById methods on VariableMap, and PR #8415 subsequently deprecated related wrapper methods on Workspace, but the versions of these methods on WorkspaceSvg were not deprecated despite continuing to call the deprecated superclass versions.

Test Coverage

Passes npm test and some manual sanity checking of variable field behaviour.

Documentation

Deprecation of variable-related methods on Workspace worth calling out in release notes.

Additional Information

Opened #8945 to track remaining (non-core/) cleanup from this series of refactors/deprecations.

BREAKING CHANGE:

This change ensures that the toolbox will be refreshed regardless of what route the VaribleMap was updated, rather than only being refreshed when it is updated via calls to methods on WorkspaceSvg.

Overall this is much more likely to fix a bug (where the toolbox wasn't being refreshed when it should have been) than cause one (by refreshing the toolbox when it shouldn't be), but this is still a behaviour change which could conceivably result an
unexpected regression.

@cpcallen cpcallen added component: variables breaking change Used to mark a PR or issue that changes our public APIs. PR: refactor labels Apr 30, 2025
@cpcallen cpcallen requested a review from gonfunko April 30, 2025 10:38
@cpcallen cpcallen requested a review from a team as a code owner April 30, 2025 10:38
Delete the following methods from WorkspaceSvg:

- renameVariableById
- deleteVariableById
- createVariable

Modify the following methods on VariableMap to call
this.workspace.refreshToolboxSelection() if this.workspace
is a WorkspaceSvg, replicating the behaviour of the
aforementioned deleted methods and additionally ensuring
that that method is called following any change to the
variable map:

- renameVariable
- changeVariableType
- renameVariableAndUses
- createVariable
- addVariable
- deleteVariable

BREAKING CHANGE:

This change ensures that the toolbox will be refreshed regardless
of what route the VaribleMap was updated, rather than only being
refreshed when it is updated via calls to methods on WorkspaceSvg.

Overall this is much more likely to fix a bug (where the toolbox
wasn't being refreshed when it should have been) than cause one
(by refreshing the toolbox when it shouldn't be), but this is
still a behaviour change which could _conceivably_ result an
unexpected regression.
Also refactor to use named imports core/variables.ts methods.
@cpcallen cpcallen force-pushed the fix/ws-var-deps branch 2 times, most recently from d114b6e to fe1ba5c Compare April 30, 2025 12:45
@cpcallen cpcallen merged commit 3d1d80d into google:rc/v12.0.0 May 2, 2025
7 checks passed
@cpcallen cpcallen deleted the fix/ws-var-deps branch May 2, 2025 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Used to mark a PR or issue that changes our public APIs. component: variables PR: refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0