-
-
Notifications
You must be signed in to change notification settings - Fork 517
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 post callback for default #5998
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #5998 +/- ##
===========================================
- Coverage 83.10% 22.62% -60.48%
===========================================
Files 291 291
Lines 43522 43546 +24
===========================================
- Hits 36170 9854 -26316
- Misses 7352 33692 +26340
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
): | ||
""" | ||
Wrap the callback and post callback around the default callback. | ||
""" | ||
def decorate(default_callback: Callable): | ||
def wrapper(self, event: param.parameterized.Event): | ||
if name == "send" and not self.active_widget.value: | ||
# don't trigger if no message to prevent duplication |
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.
This is primarily because value gets reset to "", and re-triggers the callback without this clause
clear_button = chat_interface._input_layout[-1] | ||
chat_interface.send("This shouldn't show up!", respond=False) | ||
clear_button.param.trigger("clicks") | ||
time.sleep(0.5) |
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.
Should have reviewed this more closely, time.sleep
should not be used in the test suite (except for very rare cases). Use the wait_until
utility.
Fixes post callback for existing buttons.
Also, attaches callback/post_callback to auto send on value change.
Screen.Recording.2023-12-05.at.4.48.38.PM.mov