Fix up hide/show toggle state, WITH broadcast hacK

This commit is contained in:
Eric Bailey
2024-12-12 10:53:56 -06:00
parent e3d110207e
commit 99db939beb
7 changed files with 93 additions and 41 deletions
+4 -2
View File
@@ -63,8 +63,10 @@ export async function write<K extends keyof Schema>(
[key]: value,
})
writeToStorage(_state)
broadcast.postMessage({event: {type: UPDATE_EVENT, key}})
broadcast.postMessage({event: UPDATE_EVENT}) // Backcompat while upgrading
setTimeout(() => {
broadcast.postMessage({event: {type: UPDATE_EVENT, key}})
broadcast.postMessage({event: UPDATE_EVENT}) // Backcompat while upgrading
}, 0)
}
write satisfies PersistedApi['write']
+2 -1
View File
@@ -125,7 +125,7 @@ const schema = z.object({
subtitlesEnabled: z.boolean().optional(),
/** @deprecated */
mutedThreads: z.array(z.string()),
hideSidebarTrendingTopics: z.boolean().optional(),
trendingSidebarHidden: z.boolean().optional(),
})
export type Schema = z.infer<typeof schema>
@@ -171,6 +171,7 @@ export const defaults: Schema = {
kawaii: false,
hasCheckedForStarterPack: false,
subtitlesEnabled: true,
trendingSidebarHidden: false,
}
export function tryParse(rawData: string): Schema | undefined {