Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/fix/hilla-3002' into fix/hilla-3002
Browse files Browse the repository at this point in the history
# Conflicts:
#	flow-server/src/main/resources/com/vaadin/flow/server/frontend/Flow.tsx
  • Loading branch information
Lodin committed Jan 14, 2025
2 parents 3a5c4b8 + 6f0faf4 commit fbbbdb4
Show file tree
Hide file tree
Showing 44 changed files with 484 additions and 494 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private static native boolean hasPromise(Element element, int promiseId)
public void testClientCallableMethodInDom() {
assertServerEventHandlerMethodInDom(
NodeFeatures.CLIENT_DELEGATE_HANDLERS,
element -> assertPublishedMethods(element,
el -> assertPublishedMethods(el,
new String[] { "publishedMethod" }),
"publishedMethod");
}
Expand Down Expand Up @@ -240,26 +240,11 @@ private JsArray<String> getPublishedServerMethods(Element element) {
}
}

private JsArray<String> getPublishedServerMethods(
ServerEventObject object) {
if (object == null) {
return JsCollections.array();
} else {
return object.getMethods();
}
}

private void assertPublishedMethods(Element element, String[] expected) {
assertEventHandlerMethods(() -> getPublishedServerMethods(element),
expected);
}

private void assertPolymerMethods(Element element, String[] expected) {
ServerEventObject object = WidgetUtil.crazyJsoCast(element);
assertEventHandlerMethods(() -> getPublishedServerMethods(object),
expected);
}

private void assertEventHandlerMethods(
Supplier<JsArray<String>> methodsProvider, String... expected) {
JsArray<String> publishedServerMethods = methodsProvider.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import { ReactAdapterElement } from "Frontend/generated/flow/ReactAdapter.js";
import React from "react";

class ReactRouterOutletElement extends ReactAdapterElement {
connectedCallback() {
super.connectedCallback();
this.style.display = 'contents';
}

protected render(): React.ReactElement | null {
return <Outlet />;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
* Callback which allows to handle request to map a client side DOM element to
* the server {@link Element} instance.
*
* @see Node#attachExistingElement(String, Element, ChildElementConsumer)
*
* @author Vaadin Ltd
* @since 1.0
*
Expand Down
36 changes: 0 additions & 36 deletions flow-server/src/main/java/com/vaadin/flow/dom/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -596,40 +596,4 @@ protected void ensureChildHasParent(Element child, boolean internalCheck) {
}
}
}

/**
* Attaches a child element with the given {@code tagName} which is the next
* sibling for the {@code previousSibling}.
* <p>
* The {@code previousSibling} parameter value can be {@code null} which
* means that the very first child with the given {@code tagName} will be
* used to attach (if any).
* <p>
* This method may be used to get a server side element for the client side
* DOM element which has been created on the client side aside of the
* server.
* <p>
* The element is not returned right away since it may not exist at all on
* the client side and its index in the children list is unknown. The
* provided {@code callback} is used instead to provide the mapped
* server-side element in case it has been found or report an error if it
* doesn't exist.
* <p>
* This API is experimental and disabled for public usage.
*
* @param tagName
* the tag name of the element to attach, not {@code null}
* @param previousSibling
* previous sibling, may be {@code null}
* @param callback
* the callback which will be invoked with a server side element
* instance or an error will be reported, not {@code null}
* @return this element
*/
private N attachExistingElement(String tagName, Element previousSibling,
ChildElementConsumer callback) {
getStateProvider().attachExistingElement(getNode(), tagName,
previousSibling, callback);
return getSelf();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@
*/
public class MenuRegistry {

private static final Logger log = LoggerFactory
.getLogger(MenuRegistry.class);

/**
* File routes lazy loading and caching.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ protected Serializable remove(String key) {

@Override
protected boolean mayUpdateFromClient(String key, Serializable value) {
return allowUpdateFromClient(key, value);
return allowUpdateFromClient(key);
}

@Override
Expand All @@ -212,7 +212,7 @@ protected boolean producePutChange(String key, boolean hadValueEarlier,
return super.producePutChange(key, hadValueEarlier, newValue);
}

private boolean allowUpdateFromClient(String key, Serializable value) {
private boolean allowUpdateFromClient(String key) {
AllowUpdate isAllowed = isUpdateFromClientAllowedBeforeFilter(key);
if (!AllowUpdate.NO_EXPLICIT_STATUS.equals(isAllowed)) {
return AllowUpdate.EXPLICITLY_ALLOW.equals(isAllowed);
Expand Down Expand Up @@ -476,19 +476,18 @@ private static Logger getLogger() {

/**
* The method first checks whether the update from client is allowed using
* the method {@link #allowUpdateFromClient(String, Serializable)}. Then if
* it's not allowed then it either throws or returns NO OPERATION runnable
* in case if {@link #updateFromClientFilter} disallows the update (in this
* case it's just an application business logic and we should not throw).
* the method {@link #allowUpdateFromClient(String)}. Then if it's not
* allowed then it either throws or returns NO OPERATION runnable in case if
* {@link #updateFromClientFilter} disallows the update (in this case it's
* just an application business logic and we should not throw).
*
* The logic inside the {@link #allowUpdateFromClient(String, Serializable)}
* check block repeats its own logic to make sure that:
* The logic inside the {@link #allowUpdateFromClient(String)} check block
* repeats its own logic to make sure that:
* <ul>
* <li>It's in sync with
* {@link #allowUpdateFromClient(String, Serializable)} (and
* <li>It's in sync with {@link #allowUpdateFromClient(String)} (and
* {@link #mayUpdateFromClient(String, Serializable)}
* <li>The update is disallowed by the filter (and not some other checks
* that are inside {@link #allowUpdateFromClient(String, Serializable)}
* that are inside {@link #allowUpdateFromClient(String)}
* <ul>
*
* Here is the logic flow:
Expand Down Expand Up @@ -555,7 +554,7 @@ private Runnable doDeferredUpdateFromClient(String key, Serializable value)
// Use private <code>allowUpdateFromClient</code> method instead of
// <code>mayUpdateFromClient</code> which may be overridden
// The logic below
if (!allowUpdateFromClient(key, value)) {
if (!allowUpdateFromClient(key)) {
if (isDisallowedByFilter(key)) {
return () -> {
// nop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ private String getRoutes(BeforeEnterEvent event) {
routeTemplates.forEach(
(k, v) -> routeElements.add(routeTemplateToHtml(k, v)));

routeElements.addAll(getClientRoutes(event));
routeElements.addAll(getClientRoutes());
return routeElements.stream().map(Element::outerHtml)
.collect(Collectors.joining());
}

private List<Element> getClientRoutes(BeforeEnterEvent event) {
private List<Element> getClientRoutes() {
return FrontendUtils.getClientRoutes().stream()
.filter(route -> !route.contains("$layout"))
.map(route -> route.replace("$index", ""))
Expand Down
Loading

0 comments on commit fbbbdb4

Please sign in to comment.