mirror of
https://github.com/selfxyz/self.git
synced 2026-04-27 03:01:15 -04:00
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user