use of com.vaadin.flow.component.dependency.CssImport in project flow by vaadin.
the class UIInternals method addFallbackDependencies.
private void addFallbackDependencies(DependencyInfo dependency) {
if (isFallbackChunkLoaded) {
return;
}
VaadinContext context = ui.getSession().getService().getContext();
FallbackChunk chunk = context.getAttribute(FallbackChunk.class);
if (chunk == null) {
if (getLogger().isDebugEnabled()) {
getLogger().debug("Fallback chunk is not available, skipping fallback dependencies load");
}
return;
}
Set<String> modules = chunk.getModules();
Set<CssImportData> cssImportsData = chunk.getCssImports();
if (modules.isEmpty() && cssImportsData.isEmpty()) {
getLogger().debug("Fallback chunk is empty, skipping fallback dependencies load");
return;
}
List<CssImport> cssImports = dependency.getCssImports();
List<JavaScript> javaScripts = dependency.getJavaScripts();
List<JsModule> jsModules = dependency.getJsModules();
if (jsModules.stream().map(JsModule::value).anyMatch(modules::contains)) {
loadFallbackChunk();
return;
}
if (javaScripts.stream().map(JavaScript::value).anyMatch(modules::contains)) {
loadFallbackChunk();
return;
}
if (cssImports.stream().map(this::buildData).anyMatch(cssImportsData::contains)) {
loadFallbackChunk();
return;
}
}
Aggregations