fix(app): do not crash when the browser translates the page (#2624)

This commit is contained in:
Hampus authored and GitHub committed 2026-09-09 01:24:14 +02:00
1 parent 044a2c101d
commit d729f641ff
83 files changed
+3774 -1080

No files matched your search

@@ -34,6 +34,16 @@ const ALWAYS_DISPLAY_THE_VOICE_CONNECTION_STATUS_BAR_IN_DESCRIPTOR = msg({
comment:
'Developer / debug surface — keep terse and technical. Tooltip / description for forcing the voice connection status bar visible in mocked mode.',
});
const DISABLE_TRANSLATION_DOM_GUARD_DESCRIPTOR = msg({
message: 'Disable translation DOM guard',
comment: 'Developer option label for turning off the page-translator DOM crash guard.',
});
const STOP_PATCHING_NODE_PROTOTYPE_INSERTBEFORE_AND_DESCRIPTOR = msg({
message:
'Stop patching Node.prototype insertBefore and removeChild. The app will crash again when a page translator re-parents text nodes React still holds.',
comment:
'Developer / debug surface — keep terse and technical. Tooltip / description for the translation DOM guard kill switch.',
});
const APP_STATE_DESCRIPTOR = msg({
message: 'App state',
comment: 'Developer options group for overriding app/account state.',
@@ -255,6 +265,11 @@ export const getToggleGroups = (): Array<ToggleGroup> => [
label: NO_OP_IN_APP_REPORTS_DESCRIPTOR,
description: NO_OP_IN_APP_REPORTS_DESC_DESCRIPTOR,
},
{
key: 'disableTranslationDomGuard',
label: DISABLE_TRANSLATION_DOM_GUARD_DESCRIPTOR,
description: STOP_PATCHING_NODE_PROTOTYPE_INSERTBEFORE_AND_DESCRIPTOR,
},
],
},
];
@@ -96,6 +96,7 @@ export type DeveloperOptionsState = Readonly<{
}
>;
noOpInAppReports: boolean;
disableTranslationDomGuard: boolean;
}>;
type MutableDeveloperOptionsState = {
-readonly [K in keyof DeveloperOptionsState]: DeveloperOptionsState[K];
@@ -179,6 +180,7 @@ class DeveloperOptions implements DeveloperOptionsState {
mockGiftRedeemed: boolean | null = null;
mockTitlebarPlatformOverride: DeveloperOptionsState['mockTitlebarPlatformOverride'] = 'auto';
noOpInAppReports = false;
disableTranslationDomGuard = false;
constructor() {
makeAutoObservable(this, {}, {autoBind: true});
@@ -250,6 +252,7 @@ class DeveloperOptions implements DeveloperOptionsState {
'mockTitlebarPlatformOverride',
'mockAttachmentStates',
'noOpInAppReports',
'disableTranslationDomGuard',
]);
}