question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Stylesheet is not found after UI.navigate to AppLayout in production mode

See original GitHub issue

Description 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:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
denis-anisimovcommented, May 29, 2020

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.

1reaction
denis-anisimovcommented, Jun 1, 2020

Use @Stylesheet with relative path or explicit frontend:// schema. Make a route view which navigates via UI.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 use UI.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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found