-
Notifications
You must be signed in to change notification settings - Fork 3.8k
fix: Improve flyout behavior #9576
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
Conversation
packages/blockly/core/flyout_base.ts
Outdated
| this.targetWorkspace.setResizesEnabled(false); | ||
| try { | ||
| newBlock = this.placeNewBlock(originalBlock); | ||
| return this.placeNewBlock(originalBlock); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the block is not successfully created then now the flyout is closed, where previously the event utils would be enabled but then the method would crash (without closing flyout)
I think if a block isn't ultimately created for whatever reason (not sure how likely this method is to throw an error in reality) it would be better for the flyout not to close.
i don't think you need to use a try anymore since we don't have to clean up the event utils. if placeNewBlock errors then just let it error. so you can hideChaff before you return the new block without relying on the finally block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, updated; this left this method as nothing but hideChaff() and calling through to placeNewBlock(), so I inlined placeNewBlock() here as it was private and had no other callsites.
packages/blockly/core/flyout_base.ts
Outdated
| new (eventUtils.get(EventType.VAR_CREATE))(thisVariable), | ||
| ); | ||
| // Close the flyout. | ||
| if (this.autoClose) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't hiding the chaff on the target workspace already close the flyout?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed it does, this was left over from before, but removed accordingly!
maribethb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise lgtm
The basics
The details
Resolves
Proposed Changes
This PR is a bit of a grab bag of flyout related fixes. Specifically, it:
appendInternal()instead ofappend(), the latter of which triggers an immediate (and unnecessary) render before the state of things is fully combobulated.