Skip to content

fix: show updated field value after editing in horizontal blocks #3351

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

asdsteven
Copy link

Problem:
In horizontal blocks, let's say you created a control_repeat block, if you edit the number of iteration from 4 to 5, after pressing Enter, the number is still shown as 4.

Cause:
field.js setText function would call forceRerender. Currently, forceRerender would set this.size_.width to 0 to force a render_() call later. However, this would work only if this.getSize() is indeed called later to trigger this.render_(), which is the case for vertical blocks, but not for horizontal blocks, causing the updated value not being shown.

Fix:
Setting this.size_.width to 0 was a silly trick. Since our purpose is to force render_() anyway, we could have simply called render_() directly. One may argue that, render_() should not be called immediately; some setup from sourceBlock_.render() needs to be done before this.render_() maybe called. Well, this is not true. this.render_() does not depend on sourceBlock_, or anything. We can just call it immediately.

Problem:
In horizontal blocks, let's say you created a control_repeat
block, if you edit the number of iteration from 4 to 5, after
pressing Enter, the number is still shown as 4.

Cause:
field.js setText function would call forceRerender.  Currently,
forceRerender would set this.size_.width to 0 to force a render_()
call later.  However, this would work only if this.getSize() is
indeed called later to trigger this.render_(), which is the case
for vertical blocks, but not for horizontal blocks, causing the
updated value not being shown.

Fix:
Setting this.size_.width to 0 was a silly trick.  Since our purpose
is to force render_() anyway, we could have simply called render_()
directly.  One may argue that, render_() should not be called
immediately; some setup from sourceBlock_.render() needs to be done
before this.render_() maybe called.  Well, this is not true.
this.render_() does not depend on sourceBlock_, or anything.  We
can just call it immediately.
Copy link

github-actions bot commented May 31, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@asdsteven
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant