perf: dynamically load comments on posts

This commit is contained in:
Xylight committed 2024-07-01 18:33:25 -07:00
1 parent 5407a0e62d
commit 1cde3a1f78
3 files changed
+91 -57

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
// to allow for loading before promises are finished on the client.
import { browser } from '$app/environment'
type AnyFunction = (...args: any[]) => any
export const awaitIfServer = async <T>(
promise: Promise<T>
): Promise<{
data: Promise<T> | T
}> => ({ data: browser ? promise : await promise })