An open-source, self-hosted system for apps built with web technologies.
Revert telling the Programs of a new Theme when the views are ready to cross
zohayrslileh7e5c903d2fdc
diff --git a/source/client/view/appearance/desktop-preferences.tsx b/source/client/view/appearance/desktop-preferences.tsxindex 22c30c8..047aac0 100644--- a/source/client/view/appearance/desktop-preferences.tsx+++ b/source/client/view/appearance/desktop-preferences.tsx@@ -32,8 +32,6 @@ export default function DesktopPreferencesProvider({ children }: Readonly<{ chilconst desiredScale = resolveStoredDesktopScale(storedScale.value)const desired = useMemo<DesktopPreferences>(() => ({ theme: desiredTheme, animations: desiredAnimations, scale: desiredScale }), [desiredAnimations, desiredScale, desiredTheme])const [preferences, setPreferences] = useState(desired)- // What the Programs are told: a new Theme once the Desktop starts crossing to it, so they cross with it.- const [announced, setAnnounced] = useState(desired)const current = useRef(preferences)const pending = useRef<PendingCommit | null>(null)const revision = useRef(0)@@ -72,7 +70,6 @@ export default function DesktopPreferencesProvider({ children }: Readonly<{ chilif (!themeChanged) {setPreferences(desired)- setAnnounced(desired)return}@@ -83,8 +80,6 @@ export default function DesktopPreferencesProvider({ children }: Readonly<{ chilpending.current = { preferences: desired, resolve }setPreferences(desired)})- }, () => {- if (revision.current === change) setAnnounced(desired)})}, [desired])@@ -110,7 +105,7 @@ export default function DesktopPreferencesProvider({ children }: Readonly<{ chilpending.current = null}, [])- const owner = useMemo(() => ({ preferences, announced, update, setTransaction }), [preferences, announced, update, setTransaction])+ const owner = useMemo(() => ({ preferences, update, setTransaction }), [preferences, update, setTransaction])return <DesktopPreferencesContext.Provider value={owner}>{children}</DesktopPreferencesContext.Provider>}@@ -167,8 +162,6 @@ function useMediaPreference(query: string) {interface DesktopPreferencesOwner {readonly preferences: DesktopPreferences- /** The preferences the Programs are told of, which follow a new Theme once the Desktop starts showing it. */- readonly announced: DesktopPreferencesreadonly update: (change: DesktopPreferencesUpdate) => voidreadonly setTransaction: (transaction: AppearanceTransaction) => void}diff --git a/source/client/view/appearance/theme-transition.ts b/source/client/view/appearance/theme-transition.tsindex 275fb60..89072fa 100644--- a/source/client/view/appearance/theme-transition.ts+++ b/source/client/view/appearance/theme-transition.ts@@ -22,17 +22,12 @@ type ActiveTransition = Readonly<{const active = new WeakMap<Document, ActiveTransition>()const revisions = new WeakMap<Document, number>()-/**- * Applies one theme state change through the document's old and new rendered views. `ready` runs- * when the views are ready to cross, or once the change is applied when nothing crosses: what- * should change together with the Desktop, such as the Programs in their frames, starts then.- */+/** Applies one theme state change through the document's old and new rendered views. */export function transitionTheme(document: Document,transaction: AppearanceTransaction,animated: boolean,- update: () => Promise<void>,- ready: () => void = () => undefined+ update: () => Promise<void>) {const target = document as ViewTransitionDocumentconst revision = (revisions.get(document) ?? 0) + 1@@ -44,7 +39,7 @@ export function transitionTheme(previous?.transition.skipTransition()active.delete(document)clearTransition(document)- return update().then(ready)+ return update()}const root = document.documentElement@@ -66,13 +61,11 @@ export function transitionTheme(previous?.transition.skipTransition()active.delete(document)clearTransition(document)- return update().then(ready)+ return update()}active.set(document, { revision, transition: view })- settle(view.ready, ready)-// The new view is live, not a still image: any late commit would animate// inside it. Changes stay instant until the whole transition finishes.settle(view.finished, () => {diff --git a/source/client/view/structure/structure.tsx b/source/client/view/structure/structure.tsxindex fe963d3..ede3c9d 100644--- a/source/client/view/structure/structure.tsx+++ b/source/client/view/structure/structure.tsx@@ -136,7 +136,7 @@ function ConnectedDesktop({ linkManager }: { linkManager: LinkManager }) {useReady(connectionRequirement)- const { announced, update } = useDesktopPreferences()+ const { preferences, update } = useDesktopPreferences()const inbound = ReactTunnel.useFactory(linkManager.$inbound)@@ -149,8 +149,8 @@ function ConnectedDesktop({ linkManager }: { linkManager: LinkManager }) {useRememberSystemAppearance(appearance)useEffect(function () {- void linkManager.updateDesktopPreferences(announced)- }, [linkManager, announced])+ void linkManager.updateDesktopPreferences(preferences)+ }, [linkManager, preferences])return <LinkManagerContext.Provider value={linkManager}>