Skip to content

Commit a578bbe

Browse files
authored
Handle unmounted state in NetworkContext (#53)
Add early return for unmounted component in NetworkContext. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved component initialization timing to ensure proper rendering sequencing in the network provider. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2 parents 1707701 + 5a38fb6 commit a578bbe

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/contexts/NetworkContext.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ export function NetworkProvider({ children }: NetworkProviderProps) {
2828
}
2929
}, []);
3030

31+
if (!mounted) return null;
32+
3133
const setNetwork = (network: NetworkType) => {
3234
setCurrentNetwork(network);
3335
safeLocalStorage.setItem('escrow-viewer-network', network);

0 commit comments

Comments
 (0)