From 55980a2a8487eedcc7660f94702ace9ac8e9591a Mon Sep 17 00:00:00 2001 From: David Taylor Date: Fri, 6 Dec 2024 16:05:09 +0000 Subject: [PATCH] DEV: Add workaround for chrome crash (#30157) Some users are seeing consistent "Error 5" crashes in chrome when saving/deleting bookmarks on chat messages. When crash logging is enabled, the message is: `[33466:259:1206/122312.195048:ERROR:ax_object.cc(3400)] Check failed: !NeedsToUpdateCachedValues(). Stale values: "Group" axid#7543 needsToUpdateCachedValues/disallowed isIgnored inUserAgentShadowRoot: isInert needsToUpdateChildren hasDirtyDescendants` This seems to be influenced by a few factors, including the re-render of the bookmarks button, the adjacent 'reactions' button, and also the opening/closing of the modal. Adding this `activeElement.blur` seems to avoid the issue in my manual testing. Hopefully, this can be dropped after future chrome releases. Internal topic: t/143485 --- .../javascripts/discourse/lib/chat-message-interactor.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/chat/assets/javascripts/discourse/lib/chat-message-interactor.js b/plugins/chat/assets/javascripts/discourse/lib/chat-message-interactor.js index 5e260804432..f02bb0350cf 100644 --- a/plugins/chat/assets/javascripts/discourse/lib/chat-message-interactor.js +++ b/plugins/chat/assets/javascripts/discourse/lib/chat-message-interactor.js @@ -327,6 +327,13 @@ export default class ChatMessageInteractor { @action toggleBookmark() { + // somehow, this works around a low-level chrome rendering issue which + // causes a complete browser crash when saving/deleting bookmarks in chat. + // Error message: "Check failed: !NeedsToUpdateCachedValues()." + // Internal topic: t/143485 + // Hopefully, this can be dropped in future chrome versions + document.activeElement?.blur(); + this.modal.show(BookmarkModal, { model: { bookmark: new BookmarkFormData(