-
Notifications
You must be signed in to change notification settings - Fork 20
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: add SSR HTTP Client Hints support #99
Conversation
✅ Deploy Preview for vuetify-nuxt-module ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@mubaidr I've the viewport with and height working properly on my local, since I'm adding also I guess we need to add a cookie, since we only have it on initial request, if using some switcher we'll need to restore the value from the cookie and don't sent the hint header once configured, ofc, we should change the cookie. Maybe we can use some state instead the cookie, I'm using it for the values... |
@danielroe @Mubair full viewport support added, I'll check adding auto theme support, only added support for headers, I guess we need to include a cookie for it. |
@mubaidr wrong name in previous comment... |
* docs(ssr): added caveat for viewport headers * reorder * updates * wip * wip
@danielroe @jd-solanki @mubraid added two theme support, included simple example in the playground, it is working! Also update the docs. I need to include browser detection and add support for browsers not supporting the HTTP Client Hints, we'll get a lot of mismatch hydration warnings on page reload |
@mubaidr wrong name in previous comment... |
…support client hints
The PR has been updated with the following fixes/features:
I need to include some new browsers like Samsung Browser, Arc and Brave, and check iOS/macOS Chromium based browsers, maybe we need to exclude them. I cannot test since I haven't my macOS laptop, so any help will be appreciate. |
This comment was marked as outdated.
This comment was marked as outdated.
Just curious, when using simple composable, there is no issue with hydration in my app with SSR. Why do we need client hints? Am I missing something? |
Your composable is just a workaround to avoid mismatch hydration warning/error, you can use Anyway, this PR is about having the same data in the client and the server. Adding this is about receiving the page content from the SSR response with the theme applied, that's, the page will be rendered properly (dark/light or any other theme applied). |
Doh! Totally forgot about that issue. Awesome work on that one, looking forward. |
IIRC, your composable was the workaround to restore the selected theme properly. If you don't restore the theme, then there is no hydration mismatch at all, you're refreshing the page. |
I'm splitting the client hints detection, every hint will be available depending on the browser, OS and version. I'm also trying to figure out how to solve the first request, maybe with a page reload... |
@mubaidr @jd-solanki PR updated including:
|
* tests: added safari tests in detect-browser.test.ts * tests: added firefox macos tests in detect browser
This PR will be merged, includes:
This PR will not be merged here (will go to Nuxt or Nitro), it is a small test for Http Client Hints for SSR (will work only on Chromium based browsers, tested only in Chrome and Edge on Windows):Check also Client Hints Infrastructure.
/cc @danielroe