Skip to content

Commit 3dbfcf3

Browse files
authored
Merge branch 'main' into javascript-type-module-attribute
2 parents 58e2453 + cce6379 commit 3dbfcf3

4 files changed

Lines changed: 16 additions & 14 deletions

File tree

flow-build-tools/src/main/java/com/vaadin/flow/server/frontend/FrontendTools.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public class FrontendTools {
7070
*/
7171
public static final String DEFAULT_NPM_VERSION = "11.12.1";
7272

73-
public static final String DEFAULT_PNPM_VERSION = "10.30.2";
73+
public static final String DEFAULT_PNPM_VERSION = "11.0.4";
7474

7575
private static final String MSG_PREFIX = "%n%n======================================================================================================";
7676
private static final String MSG_SUFFIX = "%n======================================================================================================%n";

flow-server/src/main/java/com/vaadin/flow/component/UI.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public class UI extends Component
133133

134134
private final UIInternals internals;
135135

136-
private final Page page = new Page(this);
136+
private final Page page;
137137

138138
private final Geolocation geolocation;
139139

@@ -166,6 +166,7 @@ protected UI(UIInternalUpdater internalsHandler) {
166166
getNode().getFeature(ElementData.class).setTag("body");
167167
Component.setElement(this, Element.get(getNode()));
168168
pushConfiguration = new PushConfigurationImpl(this);
169+
page = new Page(this);
169170
geolocation = new Geolocation(this);
170171
}
171172

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import java.io.Serializable;
1919
import java.util.Date;
20+
import java.util.Objects;
2021
import java.util.TimeZone;
2122
import java.util.function.Function;
2223

@@ -442,21 +443,23 @@ void setColorScheme(ColorScheme.Value colorScheme) {
442443
}
443444

444445
/**
445-
* Creates an ExtendedClientDetails instance from browser details JSON
446-
* object. This is intended for internal use when browser details are
447-
* provided as JSON (e.g., during UI initialization or refresh).
446+
* Parses browser details from the given JSON and updates the UI from them:
447+
* stores the resulting {@link ExtendedClientDetails} on the UI's internals
448+
* and seeds the page-visibility and geolocation-availability signals from
449+
* the same payload.
448450
* <p>
449451
* For internal use only.
450452
*
451453
* @param ui
452-
* the UI instance that owns this ExtendedClientDetails
454+
* the UI to update, not {@code null}
453455
* @param json
454456
* the JSON object containing browser details parameters
455-
* @return a new ExtendedClientDetails instance
457+
* @return the parsed details
456458
* @throws RuntimeException
457459
* if the JSON is not a valid object
458460
*/
459-
public static ExtendedClientDetails fromJson(UI ui, JsonNode json) {
461+
public static ExtendedClientDetails updateFromJson(UI ui, JsonNode json) {
462+
Objects.requireNonNull(ui, "UI must not be null");
460463
if (!(json instanceof ObjectNode)) {
461464
throw new RuntimeException("Expected a JSON object");
462465
}
@@ -494,8 +497,9 @@ public static ExtendedClientDetails fromJson(UI ui, JsonNode json) {
494497
getStringElseNull.apply("v-np"),
495498
getStringElseNull.apply("v-cs"),
496499
getStringElseNull.apply("v-tn"));
500+
ui.getInternals().setExtendedClientDetails(details);
497501
String ga = getStringElseNull.apply("v-ga");
498-
if (ga != null && ui != null) {
502+
if (ga != null) {
499503
try {
500504
ui.getInternals().setGeolocationAvailability(
501505
GeolocationAvailability.valueOf(ga));
@@ -519,8 +523,7 @@ public static ExtendedClientDetails fromJson(UI ui, JsonNode json) {
519523
public void refresh(SerializableConsumer<ExtendedClientDetails> callback) {
520524
final String js = "return Vaadin.Flow.getBrowserDetailsParameters();";
521525
final SerializableConsumer<JsonNode> resultHandler = json -> {
522-
ExtendedClientDetails details = fromJson(ui, json);
523-
ui.getInternals().setExtendedClientDetails(details);
526+
ExtendedClientDetails details = updateFromJson(ui, json);
524527
if (callback != null) {
525528
callback.accept(details);
526529
}

flow-server/src/main/java/com/vaadin/flow/server/BootstrapHandler.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,9 +1388,7 @@ private void extractAndStoreBrowserDetails(VaadinRequest request, UI ui) {
13881388
if (browserDetailsJson != null && !browserDetailsJson.isEmpty()) {
13891389
try {
13901390
JsonNode json = JacksonUtils.readTree(browserDetailsJson);
1391-
ExtendedClientDetails details = ExtendedClientDetails
1392-
.fromJson(ui, json);
1393-
ui.getInternals().setExtendedClientDetails(details);
1391+
ExtendedClientDetails.updateFromJson(ui, json);
13941392
} catch (Exception e) {
13951393
// Log and continue without browser details
13961394
getLogger().debug(

0 commit comments

Comments
 (0)