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

feat(web): theme/locale preferences and improve SSR #1832

Merged
merged 1 commit into from
Feb 22, 2023

Conversation

michelheusschen
Copy link
Contributor

Creating a new PR from #1814, because that one had a bit of a snowball effect.

  • Revamped theme switching in general and added a store for managing preferences
  • Added the svelte-local-storage-store package for persisting preferences to localStorage
  • Fixed Flash of Unstyled Content (FOUC) on initial page load when using the light theme

Suddenly SSR started actually working. Previously any server-side rendered page would have an empty <main></main> element so it wasn't doing much. Having SSR for pages means we can't use document, navigator, window, etc and a couple of issues popped up because of that:

  • Can no longer use navigator.language, so moved locale to preferences store
  • Jest can't import $app/environment so a manual mock has been added
  • Guarded browser-only calls in the lifecycle function onDestroy, because it also runs for SSR

@vercel
Copy link

vercel bot commented Feb 22, 2023

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

1 Ignored Deployment
Name Status Preview Updated
immich ⬜️ Ignored (Inspect) Feb 22, 2023 at 1:32PM (UTC)

@alextran1502 alextran1502 merged commit 10cb612 into main Feb 22, 2023
@alextran1502 alextran1502 deleted the feat/web-preferences-ssr branch February 22, 2023 17:53
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