RosePlugs: fix cross-plugin conflict with Raiden's Themes over SETTING_RENDERER_CONFIG
This commit is contained in:
parent
a9bc875029
commit
b6fc1d43aa
1 changed files with 33 additions and 10 deletions
|
|
@ -128,17 +128,38 @@ function patchTabsUI(getRows: () => SectionRow[], patches: (() => void)[]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let rendererConfigValue = settingConstants.SETTING_RENDERER_CONFIG;
|
// Raiden's Themes installs this exact same Object.defineProperty-override pattern on this same
|
||||||
|
// property. Confirmed live: whichever plugin's override installs LAST completely replaces the
|
||||||
|
// other's getter (defineProperty doesn't chain, it overwrites the whole descriptor) - freezing
|
||||||
|
// the first plugin's rows as a one-time snapshot baked into the second plugin's closure. Any
|
||||||
|
// plugin RosePlugs discovers afterward (installed mid-session, like a freshly-added plugin)
|
||||||
|
// then never reaches SETTING_RENDERER_CONFIG again, even though the section still correctly
|
||||||
|
// lists its key - the exact row-key/config mismatch that crashes Settings. Re-asserting this
|
||||||
|
// override right before every read RosePlugs itself needs (not just once at setup) guarantees
|
||||||
|
// RosePlugs' getter is always the most-recently-installed one when it actually matters, no
|
||||||
|
// matter what order plugins load in or what either one does afterward.
|
||||||
|
let baseConfigValue: any = settingConstants.SETTING_RENDERER_CONFIG;
|
||||||
|
|
||||||
Object.defineProperty(settingConstants, "SETTING_RENDERER_CONFIG", {
|
const configGetter = () => {
|
||||||
enumerable: true,
|
cacheRows(getRows());
|
||||||
configurable: true,
|
return { ...baseConfigValue, ...rendererRowCache };
|
||||||
get: () => {
|
};
|
||||||
cacheRows(getRows());
|
|
||||||
return { ...rendererConfigValue, ...rendererRowCache };
|
function ensureConfigOverride() {
|
||||||
},
|
const current = Object.getOwnPropertyDescriptor(settingConstants, "SETTING_RENDERER_CONFIG");
|
||||||
set(v: any) { rendererConfigValue = v; },
|
if (current?.get === configGetter) return;
|
||||||
});
|
|
||||||
|
baseConfigValue = current?.get ? current.get.call(settingConstants) : (current?.value ?? baseConfigValue);
|
||||||
|
|
||||||
|
Object.defineProperty(settingConstants, "SETTING_RENDERER_CONFIG", {
|
||||||
|
enumerable: true,
|
||||||
|
configurable: true,
|
||||||
|
get: configGetter,
|
||||||
|
set(v: any) { baseConfigValue = v; },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ensureConfigOverride();
|
||||||
|
|
||||||
const firstRender = Symbol("roseplugs-first-render");
|
const firstRender = Symbol("roseplugs-first-render");
|
||||||
|
|
||||||
|
|
@ -146,6 +167,7 @@ function patchTabsUI(getRows: () => SectionRow[], patches: (() => void)[]) {
|
||||||
if (!createListModule) return;
|
if (!createListModule) return;
|
||||||
patches.push(
|
patches.push(
|
||||||
after("createList", createListModule, function (args: any) {
|
after("createList", createListModule, function (args: any) {
|
||||||
|
ensureConfigOverride();
|
||||||
if (args[0][firstRender]) return;
|
if (args[0][firstRender]) return;
|
||||||
args[0][firstRender] = true;
|
args[0][firstRender] = true;
|
||||||
|
|
||||||
|
|
@ -172,6 +194,7 @@ function patchTabsUI(getRows: () => SectionRow[], patches: (() => void)[]) {
|
||||||
if (!SettingsOverviewScreen) return;
|
if (!SettingsOverviewScreen) return;
|
||||||
patches.push(
|
patches.push(
|
||||||
after("default", SettingsOverviewScreen, (args: any, ret: any) => {
|
after("default", SettingsOverviewScreen, (args: any, ret: any) => {
|
||||||
|
ensureConfigOverride();
|
||||||
if (args[0][firstRender]) return;
|
if (args[0][firstRender]) return;
|
||||||
args[0][firstRender] = true;
|
args[0][firstRender] = true;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue