Skip to content

Commit c769cc1

Browse files
authored
fix: Revert invalid change (#23644)
1 parent 53aa69b commit c769cc1

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

flow-server/src/main/java/com/vaadin/flow/signals/shared/SharedNumberSignal.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,14 @@ public Double peekConfirmed() {
121121
}
122122

123123
/**
124-
* Gets the value of this signal as an integer without registering a
125-
* dependency. Equivalent to {@code peek().intValue()}.
124+
* Gets the value of this signal as an integer. This method works in the
125+
* same way was {@link #get()} with regards to transactions and dependency
126+
* tracking.
126127
*
127128
* @return the signal value as an integer
128129
*/
129130
public int getAsInt() {
130-
return peek().intValue();
131+
return get().intValue();
131132
}
132133

133134
/**

flow-server/src/test/java/com/vaadin/flow/signals/shared/SharedNumberSignalTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ void incrementBy_concurrentIncrements_allIncrementsConsidered() {
7171
@Test
7272
void getAsInt_decimalValue_valueIsTruncated() {
7373
SharedNumberSignal signal = new SharedNumberSignal(2.718);
74-
75-
assertEquals(2, signal.getAsInt());
74+
assertEquals(2,
75+
Signal.runInTransaction(() -> signal.getAsInt()).returnValue());
7676
}
7777

7878
@Test

0 commit comments

Comments
 (0)