-
Notifications
You must be signed in to change notification settings - Fork 341
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
SSR does not add component variables #3046
Comments
Scope: This is related to Vue's The issue is caused because of Vue CJS build. In cjs build useCSSVars simply do not apply css variables. Possible solutions:
|
@asbermudez, what nuxt modules do you use? |
@m0ksem this is the output of Nuxt project info: 09:49:59
------------------------------
- Operating System: `Windows_NT`
- Node Version: `v18.14.0`
- Nuxt Version: `3.2.2`
- Nitro Version: `2.2.2`
- Package Manager: `[email protected]`
- Builder: `vite`
- User Config: `app`, `modules`, `postcss`, `vite`, `typescript`, `runtimeConfig`, `imports`, `umami`, `auth`, `nitro`
- Runtime Modules: `@sidebase/[email protected]`, `[email protected]`, `@pinia/[email protected]`, `@vuestic/[email protected]`
- Build Modules: `-`
------------------------------ |
@asbermudez, and the last question. Do you have |
@m0ksem not as far as I can see, even in the autogenerated code is not showing |
Hey, @asbermudez. Can you try |
And also check this |
@m0ksem after checking, both seems to still have the issue. Both cases I get this: VS how it was in 1.5.3: VS fully loaded (with JS hydration) |
I can confirm that But I checked You can use this command |
Yes, it does return that variable, but the input is not using it, also goes for the sizing variables for the avatar and so: (this shows when I run the page with javascript disabled, so it just renders what the server returns) For me the background colors are probably the least of the issues, but the sizing it's pretty bad as the whole UI flickers and it's bad 😅 |
@asbermudez, looks like you still using 1.6.1, not experimental verison I made. |
@m0ksem Removed my .nuxt, .output and node_modules folder, I've forced my package.json and package-lock to not have any reference to 1.6.1 and yet it still happens the same. So not sure what's going on... Edit: Not sure if it's meaningful, but I am working under Windows. AFAIK it should make no difference, but at this point I don't trust anymore. |
@asbermudez, npm creates |
@m0ksem seems I keep having the same issue.... sorry 😅 |
@m0ksem as update, if I do the same with @vuestic/[email protected] it gets even worse, it just shows everything broken xD |
My test setup is clean nuxt project with few components inside: "devDependencies": {
"nuxt": "^3.2.2"
},
"dependencies": {
"@vuestic/nuxt": "^1.0.11",
"vuestic-ui": "0.0.0-experimental-14454314a-20230223"
} We will do 1.6.2 this week. |
@m0ksem Ok, if I build and run Edit: Doesn't seem to load the custom colors in some components with the provided services, but this probably is a minor to be checked |
@m0ksem for reference, you can see the colors are not the custom ones, but it does load the base ones in the server side response: Edit I apologize for having to redact so much content... doesn't help with the full picture |
I have the same issue with Navbar, but if I change colors via nuxt-config
colors are applied correctly... |
@m0ksem unfortunately I cannot depend on fixed build custom colors (as everything in the nuxt-config gets embedded in build time), my application will have to load a different palette based on user settings. This means ideally it needs to be handled by the SSR in runtime, otherwise I will have a first load with wrong colors and the flick to the right ones, which is far from a good UX experience. But as long as for now they load later in runtime (so when the app is hydrated) I can roll with it for now. So probably we can separate that issue in a new issue. Edit: For context, this is how I load the colors in runtime when the tenant information is loaded in a store. This was working in the SSR in the previous version (1.5.x) |
As far as I can see Navbar issue is OK, because page need to load css in dev as module (likely need for hot reload). If this works OK in prod, then we will not fix it. For colors depended on request... Will handle it in a separate issue. Thanks for great conversation over here! |
Vuestic-ui version: 1.6.1
Steps to reproduce
Use VaAvatar component with SSR with Nuxt, although it happens with several components.
What is the expected behavior?
Should render the necessary visual variables by default:
What is the current behavior?
It does not render the variables and makes it look broken while it hydrates
Other information
This was not happening in version 1.5.x, for what I can see then we were not using CSS variables for some values (like size) which seems to be the source of the issue as they don't get added until hydration.
The text was updated successfully, but these errors were encountered: