|
16 | 16 | import java.util.HashMap;
|
17 | 17 | import java.util.HashSet;
|
18 | 18 | import java.util.IdentityHashMap;
|
| 19 | +import java.util.LinkedHashSet; |
19 | 20 | import java.util.List;
|
20 | 21 | import java.util.Map;
|
21 | 22 | import java.util.Optional;
|
@@ -162,7 +163,7 @@ public List<Object> getParameters() {
|
162 | 163 | */
|
163 | 164 | private long lastHeartbeatTimestamp = System.currentTimeMillis();
|
164 | 165 |
|
165 |
| - private List<PendingJavaScriptInvocation> pendingJsInvocations = new ArrayList<>(); |
| 166 | + private Set<PendingJavaScriptInvocation> pendingJsInvocations = new LinkedHashSet<>(); |
166 | 167 |
|
167 | 168 | private final HashMap<StateNode, PendingJavaScriptInvocationDetachListener> pendingJsInvocationDetachListeners = new HashMap<>();
|
168 | 169 |
|
@@ -587,7 +588,7 @@ public List<PendingJavaScriptInvocation> dumpPendingJavaScriptInvocations() {
|
587 | 588 |
|
588 | 589 | pendingJsInvocations = getPendingJavaScriptInvocations()
|
589 | 590 | .filter(invocation -> !invocation.getOwner().isVisible())
|
590 |
| - .collect(Collectors.toCollection(ArrayList::new)); |
| 591 | + .collect(Collectors.toCollection(LinkedHashSet::new)); |
591 | 592 | pendingJsInvocations
|
592 | 593 | .forEach(this::registerDetachListenerForPendingInvocation);
|
593 | 594 | return readyToSend;
|
@@ -630,8 +631,7 @@ public void execute() {
|
630 | 631 |
|
631 | 632 | private void removePendingInvocation(
|
632 | 633 | PendingJavaScriptInvocation invocation) {
|
633 |
| - UIInternals.this.pendingJsInvocations.removeIf( |
634 |
| - pendingInvocation -> pendingInvocation.equals(invocation)); |
| 634 | + UIInternals.this.pendingJsInvocations.remove(invocation); |
635 | 635 | if (invocationList.isEmpty() && registration != null) {
|
636 | 636 | registration.remove();
|
637 | 637 | registration = null;
|
|
0 commit comments