// to allow for loading before promises are finished on the client. import { browser } from '$app/environment' export const awaitIfServer = async ( promise: Promise, ): Promise<{ data: Promise | T }> => ({ data: browser ? promise : await promise }) export class ReactiveState { value = $state()! constructor(initialValue: T) { this.value = initialValue as NonNullable } }