widgets: Cache event handler instead of entire jquery for each widget.

In 61b3c698af we stopped restoring widgets
from the cache, so the only purpose of the cache remaining was to access
the event handler patched onto the widget jquery.

Now instead of the entire jquery object, we cache just the event handler
since that's the only thing we need from the cache, and do not patch it
onto the widget jquery object.
This commit is contained in:
N-Shar-ma
2024-05-08 19:46:22 +05:30
committed by Tim Abbott
parent cc793612f0
commit cb58752909
6 changed files with 37 additions and 23 deletions

View File

@@ -89,7 +89,7 @@ export function get_message_events(message: Message): SubmessageEvents | undefin
}
export function process_widget_rows_in_list(list: MessageList | undefined): void {
for (const message_id of widgetize.widget_contents.keys()) {
for (const message_id of widgetize.widget_event_handlers.keys()) {
if (list?.get(message_id) !== undefined) {
process_submessages({message_id, $row: list.get_row(message_id)});
}