From 4da79abb2149013ca6e3ed8b28d7073695bf1106 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Wed, 25 Oct 2023 14:37:54 +0200 Subject: [PATCH] Fix components filter --- src/webpack/common/components.ts | 2 +- src/webpack/patchWebpack.ts | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/webpack/common/components.ts b/src/webpack/common/components.ts index 55d3b84d4..e44b1c9f6 100644 --- a/src/webpack/common/components.ts +++ b/src/webpack/common/components.ts @@ -55,7 +55,7 @@ export const MaskedLink = waitForComponent("MaskedLink", m => m?.t export const Timestamp = waitForComponent("Timestamp", filters.byCode(".Messages.MESSAGE_EDITED_TIMESTAMP_A11Y_LABEL.format")); export const Flex = waitForComponent("Flex", ["Justify", "Align", "Wrap"]); -waitFor("FormItem", m => { +waitFor(["FormItem", "Button"], m => { ({ useToken, Card, Button, FormSwitch: Switch, Tooltip, TextInput, TextArea, Text, Select, SearchableSelect, Slider, ButtonLooks, TabBar, Popout, Dialog, Paginator, ScrollerThin, Clickable, Avatar } = m); Forms = m; }); diff --git a/src/webpack/patchWebpack.ts b/src/webpack/patchWebpack.ts index a3bc7a6f6..395c35fe5 100644 --- a/src/webpack/patchWebpack.ts +++ b/src/webpack/patchWebpack.ts @@ -90,6 +90,11 @@ function patchPush(webpackGlobal: any) { logger.error("Error in patched chunk", err); return void originalMod(module, exports, require); } + + exports = module.exports; + + if (!exports) return; + // There are (at the time of writing) 11 modules exporting the window // Make these non enumerable to improve webpack search performance if (exports === window) { @@ -226,11 +231,9 @@ function patchPush(webpackGlobal: any) { Object.defineProperty(webpackGlobal, "push", { get: () => handlePush, set(v) { - Object.defineProperty(this, "push", { - value: v, - configurable: true - }); - patchPush(this); + delete webpackGlobal.push; + webpackGlobal.push = v; + patchPush(webpackGlobal); }, configurable: true });