diff --git a/src/LiveComponent/assets/dist/live_controller.js b/src/LiveComponent/assets/dist/live_controller.js index 41177512fdd..dea75ab3b86 100644 --- a/src/LiveComponent/assets/dist/live_controller.js +++ b/src/LiveComponent/assets/dist/live_controller.js @@ -2152,6 +2152,7 @@ class Component { if (!controls.shouldRender) { return; } + this.hooks.triggerHook('loading.state:finished', this.element); if (backendResponse.response.headers.get('Location')) { if (this.isTurboEnabled()) { Turbo.visit(backendResponse.response.headers.get('Location')); @@ -2161,7 +2162,6 @@ class Component { } return; } - this.hooks.triggerHook('loading.state:finished', this.element); const modifiedModelValues = {}; Object.keys(this.valueStore.getDirtyProps()).forEach((modelName) => { modifiedModelValues[modelName] = this.valueStore.get(modelName); diff --git a/src/LiveComponent/assets/src/Component/index.ts b/src/LiveComponent/assets/src/Component/index.ts index 7db1f564a7b..7a6bdc71f1a 100644 --- a/src/LiveComponent/assets/src/Component/index.ts +++ b/src/LiveComponent/assets/src/Component/index.ts @@ -351,6 +351,11 @@ export default class Component { return; } + // remove the loading behavior now so that when we morphdom + // "diffs" the elements, any loading differences will not cause + // elements to appear different unnecessarily + this.hooks.triggerHook('loading.state:finished', this.element); + if (backendResponse.response.headers.get('Location')) { // action returned a redirect if (this.isTurboEnabled()) { @@ -362,11 +367,6 @@ export default class Component { return; } - // remove the loading behavior now so that when we morphdom - // "diffs" the elements, any loading differences will not cause - // elements to appear different unnecessarily - this.hooks.triggerHook('loading.state:finished', this.element); - /** * For any models modified since the last request started, grab * their value now: we will re-set them after the new data from