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

[Feature Request] Vuetify renderes in mobile display mode in SSR causing major layout shifts during hydration #17252

Closed
ttonyh opened this issue Apr 28, 2023 · 0 comments
Assignees
Labels
E: display Display composable SSR SSR T: enhancement Functionality that enhances existing features

Comments

@ttonyh
Copy link

ttonyh commented Apr 28, 2023

Problem to solve

Allow a default value to be set on-render so that one can fake a window width during SSR rendering, to reduce the UI from shifting on hydration.

During SSR, the server is able to get a general idea if the client is a mobile device or not by parsing the User Agent string. Although not always accurate, it's can generally be good enough for most cases.

I would like to be able to, based on mobile or desktop device, use a default value for, what Vuetify gets as the window.innerWidth. That way when the page loads and hydrates, it won't shift too dramatically as it expands or contracts, to meet the actual device width.

Proposed solution

This can easily be done with the "getClientWidth" method in display.ts:

function getClientHeight (isHydrate?: boolean) {

Instead of always returning 0, a default value can be given on every request. Maybe this can be an exposed method that's part of the useDisplay composable. Being able to set the height would also be nice; and that would work the same way using the "getClientHeight" method, in the same file.

@KaelWD KaelWD added T: enhancement Functionality that enhances existing features SSR SSR E: display Display composable labels May 3, 2023
@KaelWD KaelWD added this to the v3.3.0 (Icarus) milestone May 3, 2023
@KaelWD KaelWD self-assigned this May 3, 2023
@github-actions github-actions bot removed the S: triage label May 3, 2023
@github-actions github-actions bot closed this as completed May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E: display Display composable SSR SSR T: enhancement Functionality that enhances existing features
Projects
None yet
Development

No branches or pull requests

2 participants