Skip to content

A platform for community discussion. Free, open, simple.

FIX: ensures scrollable-list is passing scroller element (#36736)

Joffrey JAFFEUX4689abf46c51
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-channel.gjs
index bf10fbd571a..a130fc7bded 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-channel.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel.gjs
@@ -475,6 +475,7 @@ export default class ChatChannel extends Component {
DatesSeparatorsPositioner.apply(this.scroller);
this.paneState.updatePendingContentFromScrollState({
+ scroller: this.scroller,
fetchedOnce: this.messagesLoader.fetchedOnce,
canLoadMoreFuture: this.messagesLoader.canLoadMoreFuture,
state,
@@ -506,6 +507,7 @@ export default class ChatChannel extends Component {
this.chatChannelScrollPositions.delete(this.args.channel.id);
} else {
this.paneState.updatePendingContentFromScrollState({
+ scroller: this.scroller,
fetchedOnce: this.messagesLoader.fetchedOnce,
canLoadMoreFuture: this.messagesLoader.canLoadMoreFuture,
state,
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-thread.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-thread.gjs
index e0e2b1d348b..aaf9a70cf5f 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-thread.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-thread.gjs
@@ -133,6 +133,7 @@ export default class ChatThread extends Component {
DatesSeparatorsPositioner.apply(this.scroller);
this.paneState.updatePendingContentFromScrollState({
+ scroller: this.scroller,
fetchedOnce: this.messagesLoader.fetchedOnce,
canLoadMoreFuture: this.messagesLoader.canLoadMoreFuture,
state,
@@ -163,6 +164,7 @@ export default class ChatThread extends Component {
this.fetchMoreMessages({ direction: FUTURE });
} else {
this.paneState.updatePendingContentFromScrollState({
+ scroller: this.scroller,
fetchedOnce: this.messagesLoader.fetchedOnce,
canLoadMoreFuture: this.messagesLoader.canLoadMoreFuture,
state,
diff --git a/plugins/chat/assets/javascripts/discourse/lib/chat-pane-state.js b/plugins/chat/assets/javascripts/discourse/lib/chat-pane-state.js
index f4404364d10..3e57a77dca0 100644
--- a/plugins/chat/assets/javascripts/discourse/lib/chat-pane-state.js
+++ b/plugins/chat/assets/javascripts/discourse/lib/chat-pane-state.js
@@ -173,11 +173,16 @@ export default class ChatPaneState {
* @param {number} [options.distanceThresholdPixels]
*/
updatePendingContentFromScrollState(options) {
- const { fetchedOnce, canLoadMoreFuture, state, distanceThresholdPixels } =
- options;
+ const {
+ scroller,
+ fetchedOnce,
+ canLoadMoreFuture,
+ state,
+ distanceThresholdPixels,
+ } = options;
this.#updateHasPendingContentBelow({
- scroller: state?.scroller,
+ scroller,
fetchedOnce,
canLoadMoreFuture,
distanceToBottomPixels: state?.distanceToBottom?.pixels ?? 0,