diff --git a/pkg/interface/src/views/apps/chat/components/ChatWindow.tsx b/pkg/interface/src/views/apps/chat/components/ChatWindow.tsx index 5b10257ef..792967ac0 100644 --- a/pkg/interface/src/views/apps/chat/components/ChatWindow.tsx +++ b/pkg/interface/src/views/apps/chat/components/ChatWindow.tsx @@ -161,6 +161,14 @@ class ChatWindow extends Component< } } + onTopLoaded = () => { + const { graphSize, unreadCount } = this.props; + console.log(graphSize, unreadCount); + if(graphSize >= unreadCount) { + this.props.dismissUnread(); + } + }; + onBottomLoaded = () => { if(this.state.unreadIndex.eq(bigInt.zero)) { this.calculateUnreadIndex(); @@ -274,6 +282,7 @@ class ChatWindow extends Component< origin='bottom' style={virtScrollerStyle} onBottomLoaded={this.onBottomLoaded} + onTopLoaded={this.onTopLoaded} // @ts-ignore paging @liam-fitzgerald on virtualscroller props onScroll={this.onScroll} data={graph} diff --git a/pkg/interface/src/views/components/VirtualScroller.tsx b/pkg/interface/src/views/components/VirtualScroller.tsx index 0201b17cf..cb406f2e7 100644 --- a/pkg/interface/src/views/components/VirtualScroller.tsx +++ b/pkg/interface/src/views/components/VirtualScroller.tsx @@ -90,6 +90,11 @@ export interface VirtualScrollerProps { * Callback to execute when finished loading from start */ onBottomLoaded?: () => void; + /* + * Callback to execute when finished loading from end + */ + onTopLoaded?: () => void; + /* * equality function for the key type */ @@ -413,6 +418,9 @@ export default class VirtualScroller extends Component