-
Notifications
You must be signed in to change notification settings - Fork 166
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
Disallow Component to implement AppShellConfigurator #18012
Comments
Acceptance criteria: a Vaadin app with the following class should fail to start; an InvalidApplicationConfigurationException should be thrown. public class AppShell extends VerticalLayout implements AppShellConfigurator{} |
mcollovati
pushed a commit
that referenced
this issue
Dec 1, 2023
This ticket/PR has been released with Vaadin 24.4.0.alpha1 and is also targeting the upcoming stable 24.4.0 version. |
rodolforfq
pushed a commit
that referenced
this issue
Feb 8, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe your motivation
Certain customers love to take these kinds of shortcuts:
The problem with the code above is that the customer successfully shoots himself in the foot, the code fails with an exception, and it's not clear why:
The technical problem above is that AppShellConfigurator is instantiated early, when the UI hasn't been constructed yet. That means that the UI is null and the notification can not be shown.
The main problem is a design one: the developer is trying to put too many responsibilities on one class, which I don't think is a good pattern. In such situation main layout is instantiated two times:
We should disallow a programmer from taking such shortcuts.
Describe the solution you'd like
A correct behavior would actually be throwing an exception on startup if you use AppShellConfigurator on a class that extends a Component, or has any
@Route
annotations or such.Describe alternatives you've considered
Alternatively we could accept this and just document this behavior.
The text was updated successfully, but these errors were encountered: