fix: resolve issue from losing connection mid proof verifcation (#1627)

* fix: resolve issue from losing connection mid proof verifcation

* fix: properly clean up socket resource to prevent memory leak

* fix: proper memory leak fix + have both proactive/reactive reconnection

* fix: reset scroll state on QR scans and improve WebSocket reconnection handling

* chore: yarn fmt
This commit is contained in:
Evi Nova
2026-02-03 08:00:19 +10:00
committed by GitHub
parent a7b790d41c
commit ebdc639c88
3 changed files with 166 additions and 26 deletions

View File

@@ -172,6 +172,20 @@ const ProveScreen: React.FC = () => {
if (selectedAppRef.current?.sessionId !== selectedApp.sessionId) {
hasInitializedScrollStateRef.current = false;
setHasScrolledToBottom(false);
// After state reset, check if content is short using current measurements.
// Use setTimeout(0) to ensure we read values AFTER React processes the reset,
// without adding measurements to dependencies (which causes race conditions).
setTimeout(() => {
const hasMeasurements =
scrollViewContentHeight > 0 && scrollViewHeight > 0;
const isShort = scrollViewContentHeight <= scrollViewHeight + 50;
if (hasMeasurements && isShort) {
setHasScrolledToBottom(true);
hasInitializedScrollStateRef.current = true;
}
}, 0);
}
setDefaultDocumentTypeIfNeeded();