Skip to content

Commit

Permalink
Add getServerSnapshot, fix loop on SSR Subscribe
Browse files Browse the repository at this point in the history
  • Loading branch information
voliva committed Aug 4, 2023
1 parent 963ff94 commit e0a377c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/core/src/Subscribe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ export const Subscribe: React.FC<{

return fallback === undefined ? (
actualChildren
) : subscribedSource === null ? (
fallback
) : (
<Suspense fallback={fallback}>{actualChildren}</Suspense>
)
Expand Down
8 changes: 6 additions & 2 deletions packages/core/src/useStateObservable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ type VoidCb = () => void

interface Ref<T> {
source$: StateObservable<T>
args: [(cb: VoidCb) => VoidCb, () => Exclude<T, SUSPENSE>]
args: [
(cb: VoidCb) => VoidCb,
() => Exclude<T, typeof SUSPENSE>,
() => Exclude<T, typeof SUSPENSE>,
]
}

export const useStateObservable = <O>(
Expand Down Expand Up @@ -46,7 +50,7 @@ export const useStateObservable = <O>(

callbackRef.current = {
source$: null as any,
args: [, gv] as any,
args: [, gv, gv] as any,
}
}

Expand Down

0 comments on commit e0a377c

Please sign in to comment.