Skip to content

Commit d4781b7

Browse files
author
Jean-Paul
committed
1 parent e6f3265 commit d4781b7

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/LiveComponent/assets/dist/live_controller.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1975,7 +1975,8 @@ class Component {
19751975
const existingActionIndex = this.pendingActions.findIndex(action => action.name === name);
19761976
if (existingActionIndex !== -1) {
19771977
this.pendingActions[existingActionIndex].args = args;
1978-
} else {
1978+
}
1979+
else {
19791980
this.pendingActions.push({
19801981
name,
19811982
args

src/LiveComponent/assets/src/Component/index.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,15 @@ export default class Component {
163163

164164
action(name: string, args: any = {}, debounce: number|boolean = false): Promise<BackendResponse> {
165165
const promise = this.nextRequestPromise;
166-
this.pendingActions.push({
167-
name,
168-
args
169-
});
166+
const existingActionIndex = this.pendingActions.findIndex(action => action.name === name);
167+
if (existingActionIndex !== -1) {
168+
this.pendingActions[existingActionIndex].args = args;
169+
} else {
170+
this.pendingActions.push({
171+
name,
172+
args
173+
});
174+
}
170175

171176
this.debouncedStartRequest(debounce);
172177

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,7 @@
21272127
resolved "https://registry.npmjs.org/@hotwired/stimulus/-/stimulus-3.2.1.tgz"
21282128
integrity sha512-HGlzDcf9vv/EQrMJ5ZG6VWNs8Z/xMN+1o2OhV1gKiSG6CqZt5MCBB1gRg5ILiN3U0jEAxuDTNPRfBcnZBDmupQ==
21292129

2130-
"@hotwired/turbo@^8.0":
2130+
"@hotwired/turbo@^7.1.0 || ^8.0":
21312131
version "8.0.4"
21322132
resolved "https://registry.yarnpkg.com/@hotwired/turbo/-/turbo-8.0.4.tgz#5c5361c06a37cdf10dcba4223f1afd0ca1c75091"
21332133
integrity sha512-mlZEFUZrJnpfj+g/XeCWWuokvQyN68WvM78JM+0jfSFc98wegm259vCbC1zSllcspRwbgXK31ibehCy5PA78/Q==

0 commit comments

Comments
 (0)