Skip to content

Conversation

@BeksOmega
Copy link
Contributor

@BeksOmega BeksOmega commented Jan 9, 2024

The basics

The details

Resolves

Fixes #7749

Proposed Changes

Makes initiailzation for inputs and fields more consistent.

  1. Separates initialization for inputs into init and initModel to match separate initialization paths for blocks and fields.
  2. Makes it so that when fields are appended, they are always initialized (regardless of whether the block is rendered or not).

Reason for Changes

Make initialization work consistently and more understandably.

Test Coverage

Tests continue to pass.

Documentation

I'm going to write dev docs at some point about the intialization / deserialization life cycle.

Additional Information

Dependent on #7748

I had to add the early return in the render management system for uninitialized blocks because we have ~200 tests that do not properly initialize the blocks. TODO: File an issue for this once this is merged.

@BeksOmega BeksOmega requested a review from a team as a code owner January 9, 2024 18:50
@BeksOmega BeksOmega requested review from NeilFraser and removed request for a team January 9, 2024 18:50
@github-actions github-actions bot added the PR: fix Fixes a bug label Jan 9, 2024
@BeksOmega BeksOmega marked this pull request as draft January 9, 2024 18:53
@github-actions github-actions bot added PR: fix Fixes a bug and removed PR: fix Fixes a bug labels Jan 9, 2024
@BeksOmega BeksOmega force-pushed the fix/init branch 2 times, most recently from b5faae7 to 4dfa7ef Compare January 9, 2024 22:13
@github-actions github-actions bot added PR: fix Fixes a bug and removed PR: fix Fixes a bug labels Jan 9, 2024
@BeksOmega BeksOmega marked this pull request as ready for review January 17, 2024 19:21
@BeksOmega BeksOmega merged commit d708833 into RaspberryPiFoundation:v11-breaks Jan 18, 2024
BeksOmega added a commit that referenced this pull request Jan 23, 2024
* fix: reorganize initialization

* chore: fix failing tests

* fix: tests

* chore: format

* chore: remove console trace
mjgallag added a commit to mit-cml/blockly-plugins that referenced this pull request Aug 29, 2025
mjgallag added a commit to mit-cml/blockly-plugins that referenced this pull request Sep 4, 2025
* Update to Blockly 11.2.2

* Fix deprecated Blockly.inputTypes

RaspberryPiFoundation/blockly@75007a0#diff-b0eef723c99dc1228104b3187ab5ff8c524198db8a12994fcbe099f9bef4b010L654-L655

* Fix headless horizontal/vertical param toggle

RaspberryPiFoundation/blockly@5db9b5b#diff-d2452865ee29274f173594ba31093a2b8845c47113f7223ca0df1933e4b3de85L273-L274
RaspberryPiFoundation/blockly@5db9b5b#diff-d2452865ee29274f173594ba31093a2b8845c47113f7223ca0df1933e4b3de85R288-R291

* Fix Blockly.Drawer not found in blocky/core

ewpatton/appinventor-sources@6c74e5b#diff-179ada7bc9ef841c7b52e24fe50097e0ee0aad37f7f1e4d19fec4f5323ef9785L24

* Fix init/render timing issues

#68 (comment)
RaspberryPiFoundation/blockly#7777
RaspberryPiFoundation/blockly#6786
https://developers.google.com/blockly/guides/contribute/core-architecture/render-management
Co-Authored-By: TannerGabriel <40315960+TannerGabriel@users.noreply.github.com>

* Fix block warning icon

RaspberryPiFoundation/blockly@75007a0#diff-bb0de0069443e7577f62ffa96e6b51c5fafd06703f50c3eed6eb616ac87467bfL118-L124
https://developers.google.com/blockly/reference/js/blockly.blocksvg_class.setwarningtext_1_method.md

* Fix renamed editable_

RaspberryPiFoundation/blockly@61bbd7d#diff-3b78eb431743f14de69af3dbc7fa1d3d158299c58ee01e47c05c33dd205165fbL191-R191
https://github.com/google/blockly/blob/blockly-v11.2.2/core/block.ts#L921-L928

* Fix block warning icon (revert comment)

setWarningText checks for warning icon
https://github.com/google/blockly/blob/blockly-v11.2.2/core/block_svg.ts#L972

* Fix render & code generation on dropdown change

Blocky 10 caused `this.setValue(text)` to stack overflow so it was replaced with `this.doValueUpdate_(text)` which stops render & code generation. It can be removed as it's inside the field validator so the value will be set after successful validation.
ewpatton/appinventor-sources@bd2cec9
ewpatton/appinventor-sources@6c74e5b#diff-179ada7bc9ef841c7b52e24fe50097e0ee0aad37f7f1e4d19fec4f5323ef9785R41
https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators

---------

Co-authored-by: TannerGabriel <40315960+TannerGabriel@users.noreply.github.com>
Co-authored-by: TannerGabriel <gabrieltanner.code@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: fix Fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants