-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
fix: Call onFinishEditing_ for fields on mobile. #7483
Conversation
On the desktop, widgetDispose_ will call onFinishEditing_ on close. This was missing in the mobile counterpart, so any cleanups in onFinishEditing_ would not be called. Also update the message string comment while we are touching this code.
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.
Seems sensible to me, but I'm going to get a colleague who is more familiar with this part of the codebase to have a look before approving.
So, after discussing this colleagues, we'd like to suggest using the new intermediate edit events vs change events instead of Let us know if you think that approach might meet your needs, as we're not sure we want to add further support fro |
Thank you, I'll have a look. It did seem quite natural to have some control over the final value set by the field (i.e. as argued in #2496 (comment)) If I understand correctly, the suggested approach is to handle events at the block level as opposed to at the field level. Does this mean adding an event handler via This could probably work, but having it close to the field seemed logical thus far. On a related note, I was having some difficulty "merging" several |
You could do that! Or you could add one handler at the workspace level that iterates over all of the relevant blocks.
Yeah there's not a good way to do this at the moment :/ we have similar problems with other mixins. |
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.
Hello @laurensvalk We discussed this at our team meeting yesterday and decided to accept this change! We still recommend switching over to use the events since assigning to onFinishEditing_
is hacky and not TypeScript compatible. But if this functionality exists we think it makes sense to make it consistent for browsers and mobile =)
Thank you for putting up this change!
[Edit: I'll get this merged after I have a chance to manually test]
Thank you! |
On the desktop, widgetDispose_ will call onFinishEditing_ on close.
This was missing in the mobile counterpart, so any cleanups in onFinishEditing_ would not be called.
Also update the message string comment while we are touching this code.
The basics
The details
Resolves
On mobile, any cleanups in
onFinishEditing_
would not be called.It is called in
widgetDispose_
but not inshowPromptEditor_
.Proposed Changes
Call
onFinishEditing_
inshowPromptEditor_
.Reason for Changes
Make sure
onFinishEditing_
works consistently on mobile and desktop.Test Coverage
Tested on a playground hosted on desktop, viewed on Android mobile device on local network and verified that
onFinishEditing_
was not called before but is now.Documentation
Updated the docstring for the prompt translation.
Additional Information
For consideration (though possibly not needed): Should
showPromptEditor_
share more things withwidgetDispose_
likeforceRerender
and firing events or can we assume thatsetValue
does that?