Skip to content

[LiveComponent] Bugfix #1509 - Adjust sequence of operations in the resetForm function #1683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: 2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/LiveComponent/assets/dist/live_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -1972,10 +1972,16 @@ class Component {
}
action(name, args = {}, debounce = false) {
const promise = this.nextRequestPromise;
this.pendingActions.push({
name,
args
});
const existingActionIndex = this.pendingActions.findIndex(action => action.name === name);
if (existingActionIndex !== -1) {
this.pendingActions[existingActionIndex].args = args;
}
else {
this.pendingActions.push({
name,
args
});
}
this.debouncedStartRequest(debounce);
return promise;
}
Expand Down
13 changes: 9 additions & 4 deletions src/LiveComponent/assets/src/Component/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,15 @@ export default class Component {

action(name: string, args: any = {}, debounce: number|boolean = false): Promise<BackendResponse> {
const promise = this.nextRequestPromise;
this.pendingActions.push({
name,
args
});
const existingActionIndex = this.pendingActions.findIndex(action => action.name === name);
if (existingActionIndex !== -1) {
this.pendingActions[existingActionIndex].args = args;
} else {
this.pendingActions.push({
name,
args
});
}

this.debouncedStartRequest(debounce);

Expand Down
14 changes: 7 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2127,7 +2127,7 @@
resolved "https://registry.npmjs.org/@hotwired/stimulus/-/stimulus-3.2.1.tgz"
integrity sha512-HGlzDcf9vv/EQrMJ5ZG6VWNs8Z/xMN+1o2OhV1gKiSG6CqZt5MCBB1gRg5ILiN3U0jEAxuDTNPRfBcnZBDmupQ==

"@hotwired/turbo@^8.0":
"@hotwired/turbo@^7.1.0 || ^8.0":
version "8.0.4"
resolved "https://registry.yarnpkg.com/@hotwired/turbo/-/turbo-8.0.4.tgz#5c5361c06a37cdf10dcba4223f1afd0ca1c75091"
integrity sha512-mlZEFUZrJnpfj+g/XeCWWuokvQyN68WvM78JM+0jfSFc98wegm259vCbC1zSllcspRwbgXK31ibehCy5PA78/Q==
Expand Down Expand Up @@ -6695,9 +6695,9 @@ magic-string@^0.30.1, magic-string@^0.30.3:
"@jridgewell/sourcemap-codec" "^1.4.15"

magic-string@^0.30.4:
version "0.30.8"
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.8.tgz#14e8624246d2bedba70d5462aa99ac9681844613"
integrity sha512-ISQTe55T2ao7XtlAStud6qwYPZjE4GK1S/BeVPus4jrq6JuOnQ00YKQC581RWhR122W7msZV263KzVeLoqidyQ==
version "0.30.10"
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.10.tgz#123d9c41a0cb5640c892b041d4cfb3bd0aa4b39e"
integrity sha512-iIRwTIf0QKV3UAnYK4PU8uiEc4SRh5jX0mwpIwETPpHdhVM4f53RSwS/vXvN1JhGX+Cs7B8qIq3d6AH49O5fAQ==
dependencies:
"@jridgewell/sourcemap-codec" "^1.4.15"

Expand Down Expand Up @@ -8614,9 +8614,9 @@ svelte-hmr@^0.15.3:
integrity sha512-41snaPswvSf8TJUhlkoJBekRrABDXDMdpNpT2tfHIv4JuhgvHqLMhEPGtaQn0BmbNSTkuz2Ed20DF2eHw0SmBQ==

"svelte@^3.0 || ^4.0":
version "4.2.12"
resolved "https://registry.yarnpkg.com/svelte/-/svelte-4.2.12.tgz#13d98d2274d24d3ad216c8fdc801511171c70bb1"
integrity sha512-d8+wsh5TfPwqVzbm4/HCXC783/KPHV60NvwitJnyTA5lWn1elhXMNWhXGCJ7PwPa8qFUnyJNIyuIRt2mT0WMug==
version "4.2.15"
resolved "https://registry.yarnpkg.com/svelte/-/svelte-4.2.15.tgz#69f5ab9730c1d80109db2ee09427063dcf6b3512"
integrity sha512-j9KJSccHgLeRERPlhMKrCXpk2TqL2m5Z+k+OBTQhZOhIdCCd3WfqV+ylPWeipEwq17P/ekiSFWwrVQv93i3bsg==
dependencies:
"@ampproject/remapping" "^2.2.1"
"@jridgewell/sourcemap-codec" "^1.4.15"
Expand Down
Loading