Skip to content

Commit

Permalink
[@mantine/hooks] use-network: Fix incorrect initial online/offline st…
Browse files Browse the repository at this point in the history
…ate detection (#3178)

* [@mantine/hooks] use-network: Fix invalid initial state (#3177)

* [@mantine/hooks] use-network: Revert online check in useState as it causes hydration mismatch
  • Loading branch information
Sajarin-M committed Dec 17, 2022
1 parent bd02e28 commit 5b1b67c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/mantine-hooks/src/use-network/use-network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function useNetwork() {
const _navigator = navigator as any;

if (_navigator.connection) {
setStatus({ online: true, ...getConnection() });
setStatus({ online: _navigator.onLine, ...getConnection() });
_navigator.connection.addEventListener('change', handleConnectionChange);
return () => _navigator.connection.removeEventListener('change', handleConnectionChange);
}
Expand Down

0 comments on commit 5b1b67c

Please sign in to comment.