pancake-frontend icon indicating copy to clipboard operation
pancake-frontend copied to clipboard

feat: Pause toast hidden timer when page is not focused

Open memoyil opened this issue 11 months ago • 2 comments

A useful feature that when transaction made and user goes to another tab or put dapp browser into background in mobile app, the toast (success / failure) still visible when focused again

Sonner library has similar feature in later versions but it wont work if toast published when tab is unfocused, therefore a custom implementation is needed.


PR-Codex overview

The focus of this PR is to update the ToastsProvider component to manage and display toasts using the sonner library efficiently.

Detailed summary

  • Added new imports from react and @pancakeswap/hooks
  • Implemented toast management using a Map
  • Updated toast functions to handle visibility state and custom durations
  • Enhanced toast creation and deletion functionalities

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

memoyil avatar Mar 15 '24 14:03 memoyil

⚠️ No Changeset found

Latest commit: 2b35914239178b2ae69fc63383399939a3d2587c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Mar 15 '24 14:03 changeset-bot[bot]

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
aptos-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 16, 2024 0:00am
blog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 16, 2024 0:00am
bridge ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 16, 2024 0:00am
games ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 16, 2024 0:00am
uikit ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 16, 2024 0:00am
web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 16, 2024 0:00am

vercel[bot] avatar Mar 15 '24 14:03 vercel[bot]