* Rewrite. * Remove some as any casts. * Attempt fix for undefined. * Attempt fix for undefined. * Circular Deps Issue. * Circular Deps Issue. * Startup Fixes. * Startup Fixes. * Startup Fixes. * Use module import rather than lazy finds. * Button patch syntax. * Mobile Video Quest Semantics. * Button Semantics. * ErrorBoundary. * Comment. * Fix Deauth URL. * Config Structure. * Various Fixes & Additions. * Some more stuff. * Loosen Button Restrictions. * Better Labeling.
29 lines
681 B
TypeScript
29 lines
681 B
TypeScript
/*
|
|
* Vencord, a Discord client mod
|
|
* Copyright (c) 2026 Vendicated and contributors
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
*/
|
|
|
|
import { React } from "@webpack/common";
|
|
|
|
let questRerenderVersion = 0;
|
|
const listeners = new Set<() => void>();
|
|
|
|
function subscribe(listener: () => void): () => void {
|
|
listeners.add(listener);
|
|
|
|
return () => listeners.delete(listener);
|
|
}
|
|
|
|
function getSnapshot(): number {
|
|
return questRerenderVersion;
|
|
}
|
|
|
|
export function rerenderQuests(): void {
|
|
questRerenderVersion++;
|
|
listeners.forEach(listener => listener());
|
|
}
|
|
|
|
export function useQuestRerender(): number {
|
|
return React.useSyncExternalStore(subscribe, getSnapshot);
|
|
}
|