Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: useDark demo #604

Merged
merged 1 commit into from
Jul 5, 2021
Merged

fix: useDark demo #604

merged 1 commit into from
Jul 5, 2021

Conversation

ElMassimo
Copy link
Contributor

@ElMassimo ElMassimo commented Jul 5, 2021

Description 馃摉

This pull request fixes the useDark demo.

Background 馃摐

This incorrect usage causes the MouseEvent to be passed over to toggleDark, which in the current implementation results in never being able to switch back from dark mode (when system is not dark).

// v is a MouseEvent
store.value = v ? 'dark' : 'light'

The bug can be replicated in the current VueUse website.

vueuse.mp4

Future Work 馃敭

It might be desirable to log a warning or throw an error if an Event is passed to the setter in useDark, as it's very likely a mistake, and can cause the bug in the video.

This incorrect usage causes a `MouseEvent` to be passed over to `toggleDark`, which in the current implementation results in never being able to switch back from dark mode.
@antfu antfu merged commit c836a14 into vueuse:main Jul 5, 2021
@ElMassimo ElMassimo deleted the patch-1 branch July 5, 2021 23:35
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.

None yet

2 participants