Skip to content

Commit 1180ac9

Browse files
authored
Recompute scroll container if it is no longer available (#4185)
Closes #4169.
1 parent cb2c582 commit 1180ac9

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

assets/js/phoenix_live_view/hooks.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,15 @@ Hooks.InfiniteScroll = {
264264
}
265265
},
266266

267+
updated() {
268+
// Check if the scroll container still exists
269+
// https://github.com/phoenixframework/phoenix_live_view/issues/4169.
270+
if (!this.scrollContainer.isConnected) {
271+
this.destroyed();
272+
this.mounted();
273+
}
274+
},
275+
267276
destroyed() {
268277
if (this.scrollContainer) {
269278
this.scrollContainer.removeEventListener("scroll", this.onScroll);

0 commit comments

Comments
 (0)