mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 03:14:40 +03:00
Fix chat loading problems (#5899)
This commit is contained in:
parent
32861f2f33
commit
a468c6705a
@ -197,7 +197,7 @@ export class ChannelDataProvider implements IChannelDataProvider {
|
||||
const startPosition = this.getStartPosition(selectedMsg ?? this.selectedMsgId, firstNewMsgIndex)
|
||||
|
||||
const count = metadata.length
|
||||
const isLoadingLatest = startPosition === undefined || startPosition === -1
|
||||
const isLoadingLatest = startPosition === undefined || startPosition === -1 || count - startPosition <= this.limit
|
||||
|
||||
if (loadAll) {
|
||||
this.loadTail(undefined, combineActivityMessages)
|
||||
@ -206,20 +206,9 @@ export class ChannelDataProvider implements IChannelDataProvider {
|
||||
this.isTailLoading.set(true)
|
||||
const tailStart = metadata[startIndex]?.createdOn
|
||||
this.loadTail(tailStart)
|
||||
} else if (count - startPosition <= this.limit) {
|
||||
this.isTailLoading.set(true)
|
||||
const tailStart = metadata[startPosition]?.createdOn
|
||||
this.loadTail(tailStart)
|
||||
await this.loadMore('backward', tailStart)
|
||||
} else {
|
||||
const start = metadata[startPosition]?.createdOn
|
||||
|
||||
if (startPosition === 0) {
|
||||
await this.loadMore('forward', metadata[startPosition]?.createdOn, this.limit)
|
||||
} else {
|
||||
await this.loadMore('backward', start, this.limit / 2)
|
||||
await this.loadMore('forward', metadata[startPosition - 1]?.createdOn, this.limit / 2)
|
||||
}
|
||||
const newStart = Math.max(startPosition - this.limit / 2, 0)
|
||||
await this.loadMore('forward', metadata[newStart]?.createdOn, this.limit)
|
||||
}
|
||||
|
||||
this.isInitialLoadingStore.set(false)
|
||||
|
@ -236,7 +236,7 @@
|
||||
|
||||
const { scrollHeight, scrollTop, clientHeight } = scrollElement
|
||||
|
||||
return Math.ceil(scrollTop + clientHeight) === scrollHeight
|
||||
return scrollHeight - Math.ceil(scrollTop + clientHeight) <= 0
|
||||
}
|
||||
|
||||
let scrollToRestore = 0
|
||||
|
@ -32,6 +32,9 @@
|
||||
|
||||
let object: Doc | undefined = undefined
|
||||
|
||||
$: if (object?._id !== value.attachedTo) {
|
||||
object = undefined
|
||||
}
|
||||
$: iconMixin = hierarchy.classHierarchyMixin(value.attachedToClass, view.mixin.ObjectIcon)
|
||||
$: iconMixin &&
|
||||
query.query(value.attachedToClass, { _id: value.attachedTo }, (res) => {
|
||||
|
@ -232,6 +232,7 @@ export class InboxNotificationsClientImpl implements InboxNotificationsClient {
|
||||
)
|
||||
|
||||
for (const notification of notificationsToRead) {
|
||||
notification.isViewed = true
|
||||
await client.update(notification, { isViewed: true })
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user