perf: dynamically load comments on posts
This commit is contained in:
1 parent
5407a0e62d
commit
1cde3a1f78
3 files changed
+91
-57
No files matched your search
@@ -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 })
|
||||
Reference in new issue
Block a user