Skip to content

fix: install modal QRCode regeneration#1353

Merged
elribonazo merged 2 commits into
mainfrom
fix/node-qrCode-expiration
Oct 2, 2025
Merged

fix: install modal QRCode regeneration#1353
elribonazo merged 2 commits into
mainfrom
fix/node-qrCode-expiration

Conversation

@elribonazo

@elribonazo elribonazo commented Oct 2, 2025

Copy link
Copy Markdown
Contributor

Explanation

Fixes the QRCode regenerating on install modals, issue affecting both install modal web and install modal node.

This change will disconnect any pending connection and renew it once the 60 seconds of the session request expire. Still this leaves enough timeout time for the user to reply without affecting.

How to test

Node

yarn build

cd into playground/multichain-node
run

yarn start connect

U should see the QRCode regenerate after the specified seconds on screen.

Web

yarn build

cd into playground/multichain-react
run

yarn start

Open http://localhost:3000/test-dapp-multichain

Click connect and wait for 60 seconds for the QRCode to automatically regenerate

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate

Note

Ensures QR codes auto-regenerate on expiry, starts/stops expiration checks correctly, and resets any active MWP connection before initiating a new session.

  • UI/Modals:
    • AbstractInstallModal: Stop expiration check before regenerating; refresh QR/link/expiry and re-render on each tick.
    • ui/modals/node/install: Start expiration check in renderQRCode; remove from mount; ensure cleanup in unmount.
  • Core:
    • multichain/index.ts: Before creating a new ConnectionRequest, disconnect dappClient if CONNECTED or CONNECTING.
  • Transport (MWP):
    • transports/mwp/index.ts: Use a local connectionPromise with timeout handling during connect() and clear timers on completion.

Written by Cursor Bugbot for commit 7bbc1a2. This will update automatically on new commits. Configure here.

@elribonazo elribonazo force-pushed the fix/node-qrCode-expiration branch from ca7b781 to b03c82a Compare October 2, 2025 15:39
@elribonazo elribonazo self-assigned this Oct 2, 2025
@elribonazo elribonazo marked this pull request as ready for review October 2, 2025 15:42
@elribonazo elribonazo requested a review from a team as a code owner October 2, 2025 15:42
const { sessionRequest } = currentConnectionRequest;
const now = Date.now();
const remainingMs = sessionRequest.expiresAt - now;
const remainingMs = sessionRequest.expiresAt - now - 55000;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 55000 ? Can we have this as a descriptive constant ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opps sorry that was hardcoded now, my bad!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

cursor[bot]

This comment was marked as outdated.

@elribonazo elribonazo requested a review from ffmcgee725 October 2, 2025 15:53
@elribonazo elribonazo enabled auto-merge (squash) October 2, 2025 16:51
@codecov

codecov Bot commented Oct 2, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.99%. Comparing base (ac8f8c3) to head (7bbc1a2).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1353   +/-   ##
=======================================
  Coverage   74.99%   74.99%           
=======================================
  Files         184      184           
  Lines        4519     4519           
  Branches     1108     1108           
=======================================
  Hits         3389     3389           
  Misses       1130     1130           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sonarqubecloud

sonarqubecloud Bot commented Oct 2, 2025

Copy link
Copy Markdown

@elribonazo elribonazo merged commit e4be769 into main Oct 2, 2025
74 of 79 checks passed
@elribonazo elribonazo deleted the fix/node-qrCode-expiration branch October 2, 2025 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants