github vaadin/flow 24.5.0
Vaadin Flow 24.5.0

13 hours ago

All Changes since Vaadin Flow 24.4

New features

  • Automatic Flow main layouts
    Docs

    Vaadin Flow automatically adds the Flow and Hilla routes to the router layout that is marked with AtLayout new annotation:

    // Main Layout:
    @Layout
    @AnonymousAllowed
     public class MainLayout extends AppLayout {
     }
    
    // Flow route:
    @PermitAll
    @Route("flow") // no layout reference is needed
     public class FlowView extends VerticalLayout {
     }

    Includes the following commits:

    • Automatic Flow layout
      Commit · Pull request

      Automatically match layout for both flow and hilla route. format Add server layout usage information to routes.tsx template This reverts commit bad2fec. Have OutletElement as a tsx file in flow-react jar Add javadoc for auto layout getParentLayout method.

    • Generate layout.json
      Commit · Pull request

      Generate a layout.json for Hilla to automatically enable server layouts part of vaadin/hilla#2709.

  • Dynamic menu items in Flow main layout
    Docs

    Collects and provides AtMenu annotated Flow routes and Hilla views filtered by access control resolutions, can be used in the Flow main layout to render links in the navigation bar in a generic way without explicit Java classes for routes:

    // Use dynamic menus in layout class:
    List<MenuEntry> menuEntries = MenuConfiguration.getMenuEntries();
    menuEntries.forEach(entry -> {
       sideNav.addItem(new SideNavItem(entry.title(), entry.path(), new SvgIcon(entry.icon()));
    };
    
    // Flow route
    @Menu(title = "Flow view", icon = "vaadin:group")
    @Route("flow")
     public class FlowView extends VerticalLayout {
     }
    
    // Hilla view
    export const config: ViewConfig = {
       menu: {
         title: "Hilla User page",
         icon: 'vaadin:user'
       }
    };
    export default function Hilla() {
    }
    • Add collectMenuItemsList() to MenuRegistry
      Commit · Pull request · Issue

    • Get menu views api
      Commit · Pull request · Issue

      Create MenuRegistry for getting automatic menu views for population.

    • Filter client routes by authentication and role
      Commit · Pull request

      Add filtering of menu client routes by checking authentication and roles. Do not check for routes in ClientRoutesProvider as the results are generated from the same source data as the data read/generated by MenuRegistry.

  • Flow components as children for React-based component
    Doc · Commit · Pull request · Issue

    Allows having Flow Components as children in a ReactAdapterComponent (Flow wrapper for React component).

    // Example of main layout in React with a Flow component as a content in this layout:
    @Layout
    @JsModule("./ReactLayout.tsx")
    @Tag("react-layout")
    public class ReactLayout extends ReactAdapterComponent 
                               implements RouterLayout {
        @Override
        public void showRouterLayoutContent(
                                   HasElement content) {
            if (content != null) {
                // bind Flow component to React element with the "flowContent" key
                getContentElement("flowContent").appendChild(content.getElement());
            }
        }
    }
    // Main Layout in React
    class ReactLayoutElement extends ReactAdapterElement {
       protected render(hooks: RenderHooks) {
       const content = hooks.useContent('flowContent');
        return (
          <div style={{flexGrow: 1, padding: '20px'}}>
            <AppBar position="fixed">
              <Toolbar>
                <Typography variant="h6" component="div">
                  React Layout
                </Typography>
              </Toolbar>
            </AppBar>
           {content}
          </div>
        )
      }
    }
    customElements.define('react-layout', ReactLayoutElement);
  • HotSwap improvements

    Provides a single endpoint for hotswap tools that internally chooses the best strategy of UI update - full page reload or UI component reload.

    Includes the following commits:

  • Record support in Binder
    Docs · Commit · Pull request

    Provides an API to use Java Records as bean types for read-only beans in Binder.

  • Support for nonce-based strict Content Security Policy
    Docs

    Vaadin Flow isn’t generally compatible with strict CSP rules, however, with some effort, nonce-based strict CSP can be used with Vaadin Flow applications. See the linked documentation for how to set it up.

  • Add alternative translate methods to I18NProvider
    Commit · Pull request · Issue

    Adds static I18NProvider#translate methods for alternative way to get translation. Compares to calling getTranslation via VaadinService.getCurrent().getInstantiator().getI18NProvider(). translate methods throws IllegalStateException without active VaadinService.

  • Speedup startup time by excluding jars
    Commit · Pull request · Issue

    Optimize class scanning of VaadinServletContextInitializer by excluding some commonly used jars and add support for vaadin.blocked-jar boolean property in META-INF/VAADIN/package.properties to exclude whole jar content from the class scanner.

  • Added HasLabelAsText interface to NativeButtonElement.
    Commit · Pull request

  • Filterable class scanning of JAR
    Commit · Pull request · Issue

    This change improves optimization of class scanning of VaadinServletContextInitializer by reading optional configuration file within a JAR dependency. Configuration file is a regular properties file that can contain vaadin.allowed-packages or vaadin.blocked-packages to exclude/include packages being scanned by VaadinServletContextInitializer. Package exclusion/inclusion effects only classes in the JAR/module where META-INF/VAADIN/package.properties is located at. Notice that this is only affecting the performance of the class scanning of Vaadin specific annotations and types and this feature is not meant to be used for excluding packages from the whole application. E.g. excluding VaadinServiceInitListener in a Spring application is not stopping Spring and Vaadin initializing it anyway, although some time-consuming actions like DevModeServletContextListener would still exclude it for optimization.

  • Add raw html table and related components
    Commit · Pull request

  • Create converters for numeric values from NumberField
    Commit · Pull request · Issue

    This pull request introduces converter classes which converts between Numeric data types. This change addresses the need for such converters as outlined in issue #5134. With the availability of a NumberField in Vaadin, it is essential to have converters that facilitate the use of various number formats with this component.

  • Add ValueContext.getBinder()
    Commit · Pull request

    original authors: @archiecobbs and @mstahv

  • Load Lumo utility CSS by default
    Commit · Pull request

    The imports have been manually defined in all new starter projects for a long time so this is not supposed to break much anything.

  • Upgrade to TypeScript 5.5
    Commit · Pull request

  • Add application identifier to build info
    Commit · Pull request

    Gets or computes an application identifier during production build and store it into flow-build-info.json.

  • Refresh browser using dev-tools connection
    Commit · Pull request

    Uses the dev-tools websocket connection to refresh the UI when PUSH is not available, instead of forcing a page reload.

  • Push and replace without navigation callback
    Commit · Pull request · Issue

    Add feature to support replace and push without getting a callback to the server for the change.

  • Add CompletableFuture WebStorage API
    Commit · Pull request · Issue

    Adds CompletableFuture methods for WebStorage.getItem.

  • Strongly cache Copilot files
    Commit · Pull request

    Speeds up every reload as there is no need to check if the files have changed.

  • Create Fieldset - Legend Java API
    Commit · Pull request · Issue

    Java API to create a and html tag without using a custom Java class to group fields.

  • Add option to not modify readonly files during copy, add logging of time
    Commit · Pull request · Issue

    Allows to skip setting writable flag on copied files by providing the vaadin.frontend.disableWritableFlagCheckOnCopy system property. This may improve performance in certain scenarios with Windows OS.

  • Add download progress listener to FileDownloader
    Commit · Pull request

  • Make proxy reading method public
    Commit · Pull request

Changes since 24.5.0.rc2

Fixes

  • Force hot deploy with Hilla (#20251)
    Commit · Pull request

  • Add util method for detecting Hilla auto layout
    Commit · Pull request · Issue

    Adds a new util method that detects layout entries in file-routes.json.

  • Add native hints for auto layout feature (#20237)
    Commit · Pull request

  • Correct route path for MenuEntry (#20235)
    Commit · Pull request

    MenuEntry should not have route parameters included in the path for client routes. It should omit route path in same way as with Hilla automatic menu. Menu should not include nested routes for excluded menu item or for route with required parameter.

Don't miss a new flow release

NewReleases is sending notifications on new releases.