You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Creating a field that forces a re render in the initModel method causes an error when mutating the block. (See example in #3458). This specific instance is fixed, but it is still plausible that someone could create a field that forces a re render which would cause this problem. To recreate Set this.doValueUpdate_ back to setValue.
The reason is that when we mutate the block, we are setting the rendered property on the block to false in an attempt to hold off rendering until the block has been fully created (not doing so will cause #4175). However, setting rendered = false causes the fields init methods to not get called.
When the block is finally ready to be rendered it will go through and call the init methods on all the fields. Since the init methods have not been called before when we reach a field that forces a re render of the entire block(in the example in #4175 this is the field_variable) the fields that have not yet been initialized will throw an error.
Describe the solution you'd like
All this points to our blocks rendered property being overloaded as described in this comment and at the bottom of this comment. By setting some kind of flag for when we are making batch changes to a block we can avoid this issue. However, there are quite a few other issues that are around this that we should look into before deciding.
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered:
Thanks for the issue! I think this is a good summary :D #1676 Also discusses some possible meanings / uses of rendered that might be useful for deciding how to approach this.
After v11 we will use rendered to check whether a block is a Block instance or a BlockSvg instance. initialized will be used to check if initSvg or (inclusive) initModel has been called.
Is your feature request related to a problem? Please describe.
Creating a field that forces a re render in the initModel method causes an error when mutating the block. (See example in #3458). This specific instance is fixed, but it is still plausible that someone could create a field that forces a re render which would cause this problem. To recreate Set this.doValueUpdate_ back to setValue.
The reason is that when we mutate the block, we are setting the rendered property on the block to false in an attempt to hold off rendering until the block has been fully created (not doing so will cause #4175). However, setting rendered = false causes the fields init methods to not get called.
When the block is finally ready to be rendered it will go through and call the init methods on all the fields. Since the init methods have not been called before when we reach a field that forces a re render of the entire block(in the example in #4175 this is the field_variable) the fields that have not yet been initialized will throw an error.
Describe the solution you'd like
All this points to our blocks rendered property being overloaded as described in this comment and at the bottom of this comment. By setting some kind of flag for when we are making batch changes to a block we can avoid this issue. However, there are quite a few other issues that are around this that we should look into before deciding.
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: