Skip to content

fix: [lw-12155] handle page refresh in dapp connector#1688

Merged
vetalcore merged 5 commits intomainfrom
fix/lw-12155-handle-page-refresh-in-dapp-connector
Feb 5, 2025
Merged

fix: [lw-12155] handle page refresh in dapp connector#1688
vetalcore merged 5 commits intomainfrom
fix/lw-12155-handle-page-refresh-in-dapp-connector

Conversation

@vetalcore
Copy link
Copy Markdown
Contributor

@vetalcore vetalcore commented Feb 2, 2025

Checklist

  • JIRA - LW-12115
  • Proper tests implemented
  • Screenshots added.

Proposed solution

beforeunload event ❌:

  • cannot await inside the callback
  • window.close() doesn't work inside the callback
  • default confirmation modal is displayed if true is returned in the callback, with no ability to provide custom messaging (deprecated in chrome starting from version 51 …)

unload event ✅:

  • cannot await inside the callback
  • window.close() works inside the callback

Testing

Scope

  • Sign/ Confirm transaction (lace + nami mode)
  • Sign/ Confirm data (lace + nami mode)

Important

Since we cannot await in the callback, please make sure the tx was properly rejected before dapp window is closed.*

Screenshots

Attach screenshots here if implementation involves some UI changes

@vetalcore vetalcore self-assigned this Feb 2, 2025
@vetalcore vetalcore requested a review from a team as a code owner February 2, 2025 15:54
@pczeglik-iohk
Copy link
Copy Markdown
Contributor

pczeglik-iohk commented Feb 2, 2025

Allure Report

allure-report-publisher generated test report!

processReports: ✅ test report for 3e959e43

passed failed skipped flaky total result
Total 33 0 4 0 37

Copy link
Copy Markdown
Contributor

@pczeglik-iohk pczeglik-iohk left a comment

Choose a reason for hiding this comment

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

Code looks good @vetalcore

expect(setNextViewMock).toHaveBeenCalled();
});

test('Should reject transaction if unmonted', async () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

typo. missing u

@vetalcore vetalcore force-pushed the fix/lw-12155-handle-page-refresh-in-dapp-connector branch 2 times, most recently from 4877a68 to 80e1ee7 Compare February 4, 2025 13:05
@vetalcore vetalcore force-pushed the fix/lw-12155-handle-page-refresh-in-dapp-connector branch from 80e1ee7 to 3e959e4 Compare February 4, 2025 15:29
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Feb 4, 2025

@vetalcore vetalcore merged commit bff7241 into main Feb 5, 2025
@vetalcore vetalcore deleted the fix/lw-12155-handle-page-refresh-in-dapp-connector branch February 5, 2025 10:37
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.

2 participants