Skip to content

Commit 23203ac

Browse files
committed
Release the loading state before any redirect.
1 parent 0b8669f commit 23203ac

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/LiveComponent/assets/dist/live_controller.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -549,8 +549,8 @@ var HookManager_default = class {
549549
}
550550
};
551551

552-
// ../../../node_modules/.pnpm/[email protected]/node_modules/idiomorph/dist/idiomorph.esm.js
553-
var Idiomorph = function() {
552+
// ../../../node_modules/idiomorph/dist/idiomorph.esm.js
553+
var Idiomorph = (function() {
554554
"use strict";
555555
let EMPTY_SET = /* @__PURE__ */ new Set();
556556
let defaults = {
@@ -1093,7 +1093,7 @@ var Idiomorph = function() {
10931093
morph,
10941094
defaults
10951095
};
1096-
}();
1096+
})();
10971097

10981098
// src/normalize_attributes_for_comparison.ts
10991099
function normalizeAttributesForComparison(element) {
@@ -2045,6 +2045,7 @@ var Component = class {
20452045
if (!controls.shouldRender) {
20462046
return;
20472047
}
2048+
this.hooks.triggerHook("loading.state:finished", this.element);
20482049
if (backendResponse.response.headers.get("Location")) {
20492050
if (this.isTurboEnabled()) {
20502051
Turbo.visit(backendResponse.response.headers.get("Location"));
@@ -2053,7 +2054,6 @@ var Component = class {
20532054
}
20542055
return;
20552056
}
2056-
this.hooks.triggerHook("loading.state:finished", this.element);
20572057
const modifiedModelValues = {};
20582058
Object.keys(this.valueStore.getDirtyProps()).forEach((modelName) => {
20592059
modifiedModelValues[modelName] = this.valueStore.get(modelName);

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,11 @@ export default class Component {
359359
return;
360360
}
361361

362+
// remove the loading behavior now so that when we morphdom
363+
// "diffs" the elements, any loading differences will not cause
364+
// elements to appear different unnecessarily
365+
this.hooks.triggerHook('loading.state:finished', this.element);
366+
362367
if (backendResponse.response.headers.get('Location')) {
363368
// action returned a redirect
364369
if (this.isTurboEnabled()) {
@@ -370,11 +375,6 @@ export default class Component {
370375
return;
371376
}
372377

373-
// remove the loading behavior now so that when we morphdom
374-
// "diffs" the elements, any loading differences will not cause
375-
// elements to appear different unnecessarily
376-
this.hooks.triggerHook('loading.state:finished', this.element);
377-
378378
/**
379379
* For any models modified since the last request started, grab
380380
* their value now: we will re-set them after the new data from

0 commit comments

Comments
 (0)