Skip to content

Commit

Permalink
chore: replace logic to get production mode info
Browse files Browse the repository at this point in the history
  • Loading branch information
knoobie committed May 16, 2023
1 parent de90aec commit 683ba1d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
5 changes: 0 additions & 5 deletions flow-html-components/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@
<artifactId>flow-data</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-web-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.vaadin.flow.component.PropertyDescriptor;
import com.vaadin.flow.component.PropertyDescriptors;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.server.VaadinService;
import com.vaadin.flow.shared.Registration;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -137,8 +138,7 @@ public Optional<String> getFor() {
@Override
protected void onAttach(AttachEvent attachEvent) {
super.onAttach(attachEvent);
if (skipForAttributeCheck(attachEvent)
|| !attachEvent.isInitialAttach()) {
if (skipForAttributeCheck() || !attachEvent.isInitialAttach()) {
return; // skip check in production so that customer / clients /
// ops-teams are not complaining about this warning to the
// devs. This should be dealt with by devs in development
Expand Down Expand Up @@ -173,17 +173,18 @@ && getChildren().findAny().isEmpty()) {
* @return true if in production mode or the mode is unclear, false if in
* development mode
**/
private static boolean skipForAttributeCheck(AttachEvent attachEvent) {
private static boolean skipForAttributeCheck() {
if (productionMode != null) {
return productionMode;
}

var session = attachEvent.getSession();
if (session == null) {
var service = VaadinService.getCurrent();
if (service == null) {
return true;
}

productionMode = session.getConfiguration().isProductionMode();
productionMode = service.getDeploymentConfiguration()
.isProductionMode();
return productionMode;
}
}

0 comments on commit 683ba1d

Please sign in to comment.