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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix setMode which prevented user preferences from being set #17

Merged
merged 2 commits into from
Oct 28, 2023

Conversation

ollema
Copy link
Collaborator

@ollema ollema commented Oct 28, 2023

nothing to add here, now it works :)

will close #15

@changeset-bot
Copy link

changeset-bot bot commented Oct 28, 2023

🦋 Changeset detected

Latest commit: 1133236

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
mode-watcher Patch

Not sure what this means? Click here to learn what changesets are.

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

@ollema
Copy link
Collaborator Author

ollema commented Oct 28, 2023

wait, this might have other problems though, maybe we are adding some classes twice now. have to test more, think about this and maybe update this patch.

what we are trying to avoid is not setting the modeUsersPrefers by short circuiting with the if statement, so I removed the if statement. now I'm worried that calling setActiveMode could add dark to the classList twice. looking at the MDN docs it seems like classList.add might not allow duplicate classes so maybe this concern is moot

@huntabyte
Copy link
Member

Nice catch!

@huntabyte huntabyte changed the title fixed bug in setMode which prevented user preferences from being set fix setMode which prevented user preferences from being set Oct 28, 2023
@huntabyte huntabyte merged commit 9dbbb39 into svecosystem:main Oct 28, 2023
3 checks passed
@ollema ollema deleted the fix-bug-in-setMode branch November 8, 2023 20:43
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.

bug: user preference is not recorded if there is no change to the active mode
2 participants