Repository navigation
Conversation
Add a three-way Light / System / Dark theme control in place of the on/off night mode toggle, with System as the default. In System mode the app follows prefers-color-scheme and reacts live when the OS appearance changes. Previously the OS preference was read only once, and the persisted state then pinned that value forever. Users who explicitly toggled night mode before keep that choice as Light or Dark.
A failed or non-2xx feed request used to reject unhandled, leaving the card loading forever (and triggering the dev-server error overlay). Treat non-OK responses as failures, and show a retry message on the card. Product Hunt and Designer News feed URLs currently return 404.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The theme only had an on/off night mode toggle. The OS preference was read once on first load and then pinned by the persisted state, so devo never followed later system appearance changes.
This replaces the toggle with a Light / System / Dark control (System is the default):
prefers-color-schemeand updates live when the OS appearance changes, with no reload.The existing
isNightModestate is still derived and used, so cards, selects and styles are unchanged.Also: feed failures no longer spin forever
While testing, the Product Hunt card loaded forever and the dev server showed a
Failed to fetchoverlay.devo.ams3.digitaloceanspaces.com/producthunt.jsoncurrently returns 404, anddesignernews.co/api/v2/storiesdoes too. Cards now treat non-OK responses as failures and show "Couldn't load X. Retry" instead of an endless spinner. The feeds themselves still need fixing or replacing.Testing
npm run lintpasses.npm test: 16 pass, including 6 new tests intests/unit/themeMode.spec.js. They cover the System default, live OS changes, explicit overrides, migration of the old toggle, a stale persisted value on reload, and invalid modes.