|
14 | 14 | import java.util.HashMap;
|
15 | 15 | import java.util.HashSet;
|
16 | 16 | import java.util.IdentityHashMap;
|
| 17 | +import java.util.LinkedHashSet; |
17 | 18 | import java.util.List;
|
18 | 19 | import java.util.Map;
|
19 | 20 | import java.util.Optional;
|
@@ -165,7 +166,7 @@ public List<Object> getParameters() {
|
165 | 166 | */
|
166 | 167 | private long lastHeartbeatTimestamp = System.currentTimeMillis();
|
167 | 168 |
|
168 |
| - private List<PendingJavaScriptInvocation> pendingJsInvocations = new ArrayList<>(); |
| 169 | + private Set<PendingJavaScriptInvocation> pendingJsInvocations = new LinkedHashSet<>(); |
169 | 170 |
|
170 | 171 | private final HashMap<StateNode, PendingJavaScriptInvocationDetachListener> pendingJsInvocationDetachListeners = new HashMap<>();
|
171 | 172 |
|
@@ -572,7 +573,7 @@ public List<PendingJavaScriptInvocation> dumpPendingJavaScriptInvocations() {
|
572 | 573 |
|
573 | 574 | pendingJsInvocations = getPendingJavaScriptInvocations()
|
574 | 575 | .filter(invocation -> !invocation.getOwner().isVisible())
|
575 |
| - .collect(Collectors.toCollection(ArrayList::new)); |
| 576 | + .collect(Collectors.toCollection(LinkedHashSet::new)); |
576 | 577 | pendingJsInvocations
|
577 | 578 | .forEach(this::registerDetachListenerForPendingInvocation);
|
578 | 579 | return readyToSend;
|
@@ -615,8 +616,7 @@ public void execute() {
|
615 | 616 |
|
616 | 617 | private void removePendingInvocation(
|
617 | 618 | PendingJavaScriptInvocation invocation) {
|
618 |
| - UIInternals.this.pendingJsInvocations.removeIf( |
619 |
| - pendingInvocation -> pendingInvocation.equals(invocation)); |
| 619 | + UIInternals.this.pendingJsInvocations.remove(invocation); |
620 | 620 | if (invocationList.isEmpty() && registration != null) {
|
621 | 621 | registration.remove();
|
622 | 622 | registration = null;
|
|
0 commit comments