Fix persisting $$vencordPatchedSource when a module is loaded again

This commit is contained in:
Nuckyz 2024-08-20 04:13:21 -03:00
parent 3d80cb2d55
commit 66b247b2d3
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9

View file

@ -355,8 +355,16 @@ function patchFactories(factories: Record<string, (module: any, exports: any, re
if (!patch.all) patches.splice(i--, 1);
}
if (IS_DEV && mod !== originalMod) {
factory.$$vencordPatchedSource = String(mod);
if (IS_DEV) {
if (mod !== originalMod) {
factory.$$vencordPatchedSource = String(mod);
} else if (wreq != null) {
const existingFactory = wreq.m[id];
if (existingFactory != null) {
factory.$$vencordPatchedSource = existingFactory.$$vencordPatchedSource;
}
}
}
}
}