Stylesheet is not found after UI.navigate to AppLayout in production mode
See original GitHub issueDescription of the bug
The stylesheet is not loaded properly on UI.navigate
for vaadin-app-layout in production mode. Not occurring in dev mode.
See: https://github.com/appreciated/vaadin-app-layout/issues/297, also https://github.com/appreciated/vaadin-app-layout/issues/306 and https://github.com/vaadin/flow-spring-examples/issues/53
Minimal reproducible example
Navigate with UI.navigate
to an AppLayout view, e.g. from a login screen.
Expected behavior
Correctly loaded stylesheet.
Actual behavior
Server can not find stylesheet, resulting in missing style until page reload.
Workaround
Replace UI.navigate(...)
with UI.getCurrent().getPage().setLocation(...)
(suggested in https://github.com/appreciated/vaadin-app-layout/issues/297)
Tested versions:
- Vaadin / Flow version: 14.2.0.beta1 / 2.2 (also tested with latest 14.1.x versions)
- Java version: OpenJDK-11
- OS version: Windows10 (1909) and Debian 10 (Buster)
- Browser version: Vivaldi (3.0.1874.32) based on Chromium (81.0.4044.123)
- IDE: IntelliJ 2020.1.1
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:12 (8 by maintainers)
Top Results From Across the Web
New CSS file is empty/404 not found in chrome inspector after ...
I just made a new CSS file and named it new-style.css in my Laravel project. The path is public/assets/css . It's just a...
Read more >Importing Style Sheets | Styling and Themes | Flow - Vaadin
In server-side views (Java), use the @CssImport annotation to import local/bundled style sheets and the @StyleSheet annotation to import ...
Read more >ASP.NET Core Blazor layouts - Microsoft Learn
The following example sets a layout component named ErrorLayout for the MainLayout component's NotFound template ( <NotFound>.
Read more >Solving the React Error: Not Picking Up CSS Style | Pluralsight
In this guide, you will learn about the errors that can occur while importing a CSS file into your React file.
Read more >How CSS and Less files are preprocessed and how to debug ...
Client-side Less compilation. When your application is not in the production mode, you can set Magento to compile .less files in a browser, ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry, for this specific issue after spending several days I was able to reproduce it.
One more time : thanks to @rolandoisidoro who helped with this.
Use
@Stylesheet
with relative path or explicitfrontend://
schema. Make a route view which navigates viaUI.navigate
to the view above (with@Stylesheet
).It works fine in dev mode, it doesn’t work in production mode. If you load view with
@Stylesheet
directly (without programatic navigation) then it works fine. It’s necessary to useUI.navigate
.This is a consequence of applying URI resolution on the client side which uses compatibility mode URLs . Compatibility mode URLs should not be sent to the client side if app is running without compatibility mode.