Skip to content

@CssImport of the add-on gets ignored in production mode on the first load #17221

Closed

Description

@TatuLund

Description of the bug

I have an add-on that has some styles of its own, say, e.g. TwinColSelect

@Tag("twin-col-select")
@CssImport(value = "./twincolselect.css")
@CssImport(value = "./twincolselect-checkbox.css", themeFor = "vaadin-checkbox")
public class TwinColSelect<T> extends AbstractField<TwinColSelect<T>, Set<T>>
...
}

This worked ok in Vaadin 24.0, but styles fails to load in Vaadin 24.1.3 in production mode when using the add-on in actual app. However in Vaadin 24.1.3 styles are loaded ok in development mode.

Production mode looks like this

image

Expected behavior

The development mode works, I would expect to see the same in production mode

image

Minimal reproducible example

See above

Versions

  • Vaadin / Flow version: 24.1.3
  • Java version: 17

Activity

  1. TatuLund commented on Jul 14, 2023

    @TatuLund
    ContributorAuthor

    Furher info, I can see the following warning in the console log in production mode

    image

    Also, if I reload the page, the styles are being loaded. I.e. the bug happens only at the first load of the view.

  2. changed the title [-]@CssImport of the add-on gets ignored in production mode[/-] [+]@CssImport of the add-on gets ignored in production mode on the first load[/+] on Jul 14, 2023
  3. knoobie commented on Jul 14, 2023

    @knoobie
    Contributor

    I'm wondering.. does this also effect 24.1.1? Or could this be related to https://github.com/vaadin/flow/pull/17129/files?

  4. mcollovati commented on Jul 18, 2023

    @mcollovati
    Collaborator

    @TatuLund I did a quick test adding TwinColSelect add-on to the flow spring starter application.
    I built for production and the styles seem to be correct, and I cannot see the error on the console.

    Could you provide an example project that reproduces the issue? Maybe it happens when mixing different add-ons or with a some custom theme settings?

  5. knoobie commented on Jul 18, 2023

    @knoobie
    Contributor

    I have seen the same error in the production client log with the following setup:

    • Addon with for
    • Addon is NOT included in the "" or login page
    • User navigated to the page containing the addon
    • Error is shown in the log
  6. mcollovati commented on Jul 18, 2023

    @mcollovati
    Collaborator

    Tried also that way, but I'm still not able to reproduce

  7. mcollovati commented on Jul 18, 2023

    @mcollovati
    Collaborator

    Ok, I can reproduce the issue if I load a page with a CheckBox component and then navigate to the route with the TwinColSelect add-on

  8. mcollovati commented on Jul 18, 2023

    @mcollovati
    Collaborator

    Same issue also with Vaadin 24.1.1 and 24.1.0

  9. added a commit that references this issue on Aug 9, 2023
    7920122
  10. added a commit that references this issue on Aug 12, 2023
    9e3d938
  11. added 2 commits that reference this issue on Aug 12, 2023
    0315f72
    4e8ca61
  12. vaadin-bot commented on Aug 17, 2023

    @vaadin-bot
    Collaborator

    This ticket/PR has been released with Vaadin 24.2.0.alpha7 and is also targeting the upcoming stable 24.2.0 version.

  13. vaadin-bot commented on Aug 22, 2023

    @vaadin-bot
    Collaborator

    This ticket/PR has been released with Vaadin 24.1.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions