Skip to content

Commit

Permalink
[C-2419] Fix offline lineup loading (#3164)
Browse files Browse the repository at this point in the history
  • Loading branch information
amendelsohn authored Apr 4, 2023
1 parent 920e25b commit be855a4
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions packages/mobile/src/hooks/useReachabilityEffect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,20 @@ export const useReachabilityEffect = (

const handleReachabilityStateChange = useCallback(
(nextReachabilityState: boolean) => {
const wasUnreachable = includeFirstRender
? !prevReachability
: prevReachability !== undefined && !prevReachability
const isFirstRenderRun =
includeFirstRender && prevReachability === undefined
const wasUnreachable = prevReachability !== undefined && !prevReachability
const wasReachable = prevReachability !== undefined && prevReachability

const wasReachable = includeFirstRender
? prevReachability
: prevReachability !== undefined && prevReachability

if (nextReachabilityState && wasUnreachable && onBecomeReachable) {
if (
nextReachabilityState &&
(wasUnreachable || isFirstRenderRun) &&
onBecomeReachable
) {
onBecomeReachable()
} else if (
!nextReachabilityState &&
wasReachable &&
(wasReachable || isFirstRenderRun) &&
onBecomeUnreachable
) {
onBecomeUnreachable()
Expand Down

0 comments on commit be855a4

Please sign in to comment.