Skip to content

Commit 2fd6689

Browse files
committed
render hook fix revision
1 parent 233b5e9 commit 2fd6689

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

src/LiveComponent/assets/dist/live_controller.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2022,15 +2022,6 @@ var Component = class {
20222022
return response;
20232023
}
20242024
this.processRerender(html, backendResponse);
2025-
const liveUrl = backendResponse.getLiveUrl();
2026-
if (liveUrl) {
2027-
history.replaceState(
2028-
history.state,
2029-
"",
2030-
new URL(liveUrl + window.location.hash, window.location.origin)
2031-
);
2032-
}
2033-
this.hooks.triggerHook("render:finished", this);
20342025
this.backendRequest = null;
20352026
thisPromiseResolve(backendResponse);
20362027
if (this.isRequestPending) {
@@ -2107,6 +2098,11 @@ var Component = class {
21072098
})
21082099
);
21092100
});
2101+
const liveUrl = backendResponse.getLiveUrl();
2102+
if (liveUrl) {
2103+
history.replaceState(history.state, "", new URL(liveUrl + window.location.hash, window.location.origin));
2104+
}
2105+
this.hooks.triggerHook("render:finished", this);
21102106
}
21112107
calculateDebounce(debounce) {
21122108
if (debounce === true) {

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -328,16 +328,6 @@ export default class Component {
328328
}
329329

330330
this.processRerender(html, backendResponse);
331-
const liveUrl = backendResponse.getLiveUrl();
332-
if (liveUrl) {
333-
history.replaceState(
334-
history.state,
335-
'',
336-
new URL(liveUrl + window.location.hash, window.location.origin)
337-
);
338-
}
339-
340-
this.hooks.triggerHook('render:finished', this);
341331

342332
// finally resolve this promise
343333
this.backendRequest = null;
@@ -448,6 +438,17 @@ export default class Component {
448438
})
449439
);
450440
});
441+
442+
const liveUrl = backendResponse.getLiveUrl();
443+
if (liveUrl) {
444+
history.replaceState(
445+
history.state,
446+
'',
447+
new URL(liveUrl + window.location.hash, window.location.origin)
448+
);
449+
}
450+
451+
this.hooks.triggerHook('render:finished', this);
451452
}
452453

453454
private calculateDebounce(debounce: number | boolean): number {

0 commit comments

Comments
 (0)