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

Track changes in parent theme #19887

Open
TobiasSagmeister opened this issue Sep 4, 2024 · 6 comments
Open

Track changes in parent theme #19887

TobiasSagmeister opened this issue Sep 4, 2024 · 6 comments

Comments

@TobiasSagmeister
Copy link

TobiasSagmeister commented Sep 4, 2024

Describe your motivation

For Vaadin themes, there is a file called theme.json which has a property parent for the parent theme.
With this property it is possible to achieve inheritance of themes.

In dev mode, only the current theme, not the parent one, is tracked for changes.
Therefore the server has to be restarted on each change in the parent theme.

In our case the themes are located in own modules.

Describe the solution you'd like

The parent theme should be tracked for changes as well.
So no restart of the server is needed.

Describe alternatives you've considered

The default maven way in com.vaadin.base.devserver.ExternalDependencyWatcher is to consider only the maven parent and its child modules. In case there is a child module which has a dependency to another module with resources (e.g. the parent theme), it does not work.

There is an undocumented property called frontend.hotdeploy.dependencies.
It defines a comma-separated list of folders to monitor in com.vaadin.base.devserver.ExternalDependencyWatcher.
With this property it works for such use cases as kind of workaround.

Additional context

This feature request was discussed previously via Vaadin Expert Chat.

@Artur-
Copy link
Member

Artur- commented Sep 4, 2024

The parent theme is tracked, provided you have a multi module project with the parent and the child theme. But you are saying that your setup is such that you build a jar of the parent theme, copy it somewhere and then you want hot deployment to work?

@TobiasSagmeister
Copy link
Author

TobiasSagmeister commented Sep 4, 2024

In com.vaadin.base.devserver.ExternalDependencyWatcher, the parent pom is evaluated for its child modules.
Only these directories are tracked for changes.
But in our case in one of this modules, there is the dependency to the parent theme, which is not considered.

@Artur-
Copy link
Member

Artur- commented Sep 4, 2024

So what is the project layout like?

@TobiasSagmeister
Copy link
Author

TobiasSagmeister commented Sep 4, 2024

Our project structure is like this:

  • Parent-Module
    • Parent-Theme-Module
    • Project-Module
      • Project-Server-Module
      • Project-Theme-Module
        • (Dependency to Parent-Theme-Module)

Meanwhile I found a solution for us with the mentioned property.
We load the paths to the resource directories from the class path and set them in the property.

@mshabarov
Copy link
Contributor

mshabarov commented Sep 10, 2024

A few thoughts for next steps:

  1. This parameter is not documented, it makes sense to add it to documentation.
  2. For Vite dev server mode and for bundle mode Flow has different implementations for theme changes monitoring, we have to know/test in which mode the above use case doesn't work.
  3. Perhaps the direct parent theme is monitored, but not the all hierarchy of parent themes.

@TobiasSagmeister could you please share which mode do you use (Vite dev server or bundle) and what is the Vaadin version?

@TobiasSagmeister
Copy link
Author

@mshabarov Sure, we use Vite-Server with Vaadin 24.4.6.

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

No branches or pull requests

3 participants