@nonamelego/dsh-catppuccin 0.5.0-beta.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.js +16 -1
- package/lib/client.js.map +1 -1
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -3445,6 +3445,20 @@ window.__ModuleLoader__.load({
|
|
|
3445
3445
|
localStorage.setItem(OVERRIDES_KEY, JSON.stringify(value));
|
|
3446
3446
|
} catch {}
|
|
3447
3447
|
}
|
|
3448
|
+
let overridesSnapshotCache = null;
|
|
3449
|
+
/** Stable-reference snapshot of the token overrides for `useSyncExternalStore`.
|
|
3450
|
+
* `readOverrides()` parses localStorage and returns a NEW object per call —
|
|
3451
|
+
* a React store whose getSnapshot returns a fresh reference every time loops
|
|
3452
|
+
* forever ("Maximum update depth exceeded") and the settings row crashes.
|
|
3453
|
+
* This accessor returns the SAME object while the persisted map is unchanged
|
|
3454
|
+
* and swaps only when the content actually differs. */
|
|
3455
|
+
function overridesSnapshot() {
|
|
3456
|
+
const next = readOverrides();
|
|
3457
|
+
const cached = overridesSnapshotCache;
|
|
3458
|
+
if (cached !== null && JSON.stringify(cached) === JSON.stringify(next)) return cached;
|
|
3459
|
+
overridesSnapshotCache = next;
|
|
3460
|
+
return next;
|
|
3461
|
+
}
|
|
3448
3462
|
/** Read the persisted shiki style (absent means the shipped default). */
|
|
3449
3463
|
function readShikiStyle() {
|
|
3450
3464
|
try {
|
|
@@ -3743,7 +3757,7 @@ window.__ModuleLoader__.load({
|
|
|
3743
3757
|
theme.setTheme(flavor.themeId);
|
|
3744
3758
|
scheduleDurablePersist(persistLocal);
|
|
3745
3759
|
},
|
|
3746
|
-
overrides:
|
|
3760
|
+
overrides: overridesSnapshot,
|
|
3747
3761
|
setOverrides: (overrides) => {
|
|
3748
3762
|
writeOverrides(overrides);
|
|
3749
3763
|
emitPrefs();
|
|
@@ -3862,6 +3876,7 @@ window.__ModuleLoader__.load({
|
|
|
3862
3876
|
exports.flavorFromThemeId = flavorFromThemeId;
|
|
3863
3877
|
exports.flavorInfo = flavorInfo;
|
|
3864
3878
|
exports.inject = inject;
|
|
3879
|
+
exports.overridesSnapshot = overridesSnapshot;
|
|
3865
3880
|
exports.readAutoCheck = readAutoCheck;
|
|
3866
3881
|
exports.readFlavor = readFlavor;
|
|
3867
3882
|
exports.readOverrides = readOverrides;
|