Fix ReactDOM

This commit is contained in:
Daniel 2025-05-08 00:48:47 +02:00
parent 661d8a0321
commit c44aee78a1

View file

@ -152,7 +152,7 @@ export const WebpackHolder = {
byPrototypeKeys(fields) {
return x =>
x.prototype &&
fields.every(field => field in x.prototype);
[...fields.flat()].every(field => field in x.prototype);
},
},
getModule: BdApi_getModule,
@ -228,7 +228,7 @@ export const WebpackHolder = {
},
getByStrings(...strings) {
const moreOpts = getOptions(strings);
return this.getModule(this.Filters.byStrings(...strings), moreOpts);
return this.getModule(this.Filters.byStrings(...strings.flat()), moreOpts);
},
getBySource(...strings) {
const moreOpts = getOptions(strings);
@ -351,6 +351,8 @@ type SettingsType = {
options?: { label: string, value: number }[],
};
const _ReactDOM_With_createRoot = {} as typeof Vencord.Webpack.Common.ReactDOM & { createRoot: typeof Vencord.Webpack.Common.createRoot };
export const UIHolder = {
alert(title: string, content: any) {
return this.showConfirmationModal(title, content, { cancelText: null });
@ -864,7 +866,9 @@ class BdApiReImplementationInstance {
enableSetting(collection, category, id) { }
disableSetting(collection, category, id) { }
get ReactDOM() {
return WebpackHolder.getModule(x => x.render && x.findDOMNode);
if (_ReactDOM_With_createRoot.createRoot === undefined)
Object.assign(_ReactDOM_With_createRoot, { ...Vencord.Webpack.Common.ReactDOM, createRoot: Vencord.Webpack.Common.createRoot });
return _ReactDOM_With_createRoot;
}
get ReactUtils() {
return {