Skip to content

Conversation

@calebchiam
Copy link
Contributor

@calebchiam calebchiam commented Apr 15, 2025

Context

Follow-up to #279.

#279 (comment)

image

Approach

Check that wakeLock.current === null before attempting to reacquire the lock.

Instead of using the vanilla await navigator.wakeLock.request('screen'), use the already-defined request() method to reacquire the lock. This ensures the release state and onRelease handlers are updated/called properly.

@vercel
Copy link

vercel bot commented Apr 15, 2025

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

Name Status Preview Comments Updated (UTC)
react-screen-wake-lock ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 15, 2025 3:46pm

Copy link
Owner

@jorisre jorisre left a comment

Choose a reason for hiding this comment

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

LGTM thanks!

@jorisre
Copy link
Owner

jorisre commented Apr 15, 2025

@calebchiam Some tests are failing, can you have a look?

@calebchiam
Copy link
Contributor Author

calebchiam commented Apr 15, 2025

@jorisre thanks for the quick review, dropped the old test, which is no longer relevant

testing it further, will ping in a bit

@calebchiam
Copy link
Contributor Author

@jorisre fixed the deeper issue of this not calling onRelease or updating the released state. Tests should pass now!

@jorisre jorisre merged commit 227d277 into jorisre:main Apr 15, 2025
5 checks passed
@github-actions
Copy link

🎉 This PR is included in version 3.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants