Skip to content

Commit bc5ca60

Browse files
authored
fix: make ExtendedClientDetails.refresh take a serializable parameter (#22759)
1 parent 13a75eb commit bc5ca60

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

flow-server/src/main/java/com/vaadin/flow/component/page/ExtendedClientDetails.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import java.io.Serializable;
1919
import java.util.Date;
2020
import java.util.TimeZone;
21-
import java.util.function.Consumer;
2221
import java.util.function.Function;
2322

2423
import tools.jackson.databind.JsonNode;
@@ -37,7 +36,8 @@
3736
* {@link Page#getExtendedClientDetails()} and cached for the lifetime of the
3837
* UI. The fetch happens asynchronously, so the first call may return
3938
* {@code null} while the data is being retrieved. To update the cached values
40-
* with fresh data from the browser, use {@link #refresh(Consumer)}.
39+
* with fresh data from the browser, use
40+
* {@link #refresh(SerializableConsumer)}}.
4141
*
4242
* @author Vaadin Ltd
4343
* @since 2.0
@@ -459,7 +459,7 @@ public static ExtendedClientDetails fromJson(UI ui, JsonNode json) {
459459
* a callback that will be invoked with the updated
460460
* ExtendedClientDetails when the refresh is complete
461461
*/
462-
public void refresh(Consumer<ExtendedClientDetails> callback) {
462+
public void refresh(SerializableConsumer<ExtendedClientDetails> callback) {
463463
final String js = "return Vaadin.Flow.getBrowserDetailsParameters();";
464464
final SerializableConsumer<JsonNode> resultHandler = json -> {
465465
ExtendedClientDetails details = fromJson(ui, json);

flow-server/src/main/java/com/vaadin/flow/component/page/Page.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import java.util.Arrays;
2424
import java.util.Objects;
2525
import java.util.UUID;
26-
import java.util.function.Consumer;
2726

2827
import com.vaadin.flow.component.Direction;
2928
import com.vaadin.flow.component.UI;
@@ -488,11 +487,11 @@ public interface ExtendedClientDetailsReceiver extends Serializable {
488487
* If details are not yet available, this method returns a placeholder
489488
* instance with default values (dimensions set to -1). If you need to fetch
490489
* the actual values in such cases, use
491-
* {@link ExtendedClientDetails#refresh(Consumer)} to explicitly retrieve
492-
* updated values from the browser.
490+
* {@link ExtendedClientDetails#refresh(SerializableConsumer)} to explicitly
491+
* retrieve updated values from the browser.
493492
* <p>
494493
* To refresh the cached values with updated data from the browser at any
495-
* time, use {@link ExtendedClientDetails#refresh(Consumer)}.
494+
* time, use {@link ExtendedClientDetails#refresh(SerializableConsumer)}.
496495
*
497496
* @return the extended client details (never {@code null})
498497
*/
@@ -508,7 +507,8 @@ public ExtendedClientDetails getExtendedClientDetails() {
508507
* @param receiver
509508
* the callback to which the details are provided
510509
* @deprecated Use {@link #getExtendedClientDetails()} to get the cached
511-
* details, or {@link ExtendedClientDetails#refresh(Consumer)}
510+
* details, or
511+
* {@link ExtendedClientDetails#refresh(SerializableConsumer)}
512512
* to refresh the cached values.
513513
*/
514514
@Deprecated

0 commit comments

Comments
 (0)