cleanup: use ReactiveState to provide $state with sveltekit (#492)

This commit is contained in:
Xylight authored and GitHub committed 2025-02-17 13:37:37 -08:00
1 parent 589db4dcc7
commit 7c46e616f8
18 files changed
+168 -168

No files matched your search

+1 -1
View File
@@ -29,7 +29,7 @@ export const addSubscription = (
if (subscribe && index == -1) {
profile.data.user?.follows.push({
// @ts-ignore
follower: p.user.follows[0]?.follower,
follower: profile.data.user.follows[0]?.follower,
community: community,
})
} else {
@@ -7,3 +7,11 @@ export const awaitIfServer = async <T>(
): Promise<{
data: Promise<T> | T
}> => ({ data: browser ? promise : await promise })
export class ReactiveState<T> {
value = $state<T>()!
constructor(initialValue: T) {
this.value = initialValue as NonNullable<T>
}
}