mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-21 07:46:24 +00: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 startPosition = this.getStartPosition(selectedMsg ?? this.selectedMsgId, firstNewMsgIndex)
|
||||||
|
|
||||||
const count = metadata.length
|
const count = metadata.length
|
||||||
const isLoadingLatest = startPosition === undefined || startPosition === -1
|
const isLoadingLatest = startPosition === undefined || startPosition === -1 || count - startPosition <= this.limit
|
||||||
|
|
||||||
if (loadAll) {
|
if (loadAll) {
|
||||||
this.loadTail(undefined, combineActivityMessages)
|
this.loadTail(undefined, combineActivityMessages)
|
||||||
@ -206,20 +206,9 @@ export class ChannelDataProvider implements IChannelDataProvider {
|
|||||||
this.isTailLoading.set(true)
|
this.isTailLoading.set(true)
|
||||||
const tailStart = metadata[startIndex]?.createdOn
|
const tailStart = metadata[startIndex]?.createdOn
|
||||||
this.loadTail(tailStart)
|
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 {
|
} else {
|
||||||
const start = metadata[startPosition]?.createdOn
|
const newStart = Math.max(startPosition - this.limit / 2, 0)
|
||||||
|
await this.loadMore('forward', metadata[newStart]?.createdOn, this.limit)
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isInitialLoadingStore.set(false)
|
this.isInitialLoadingStore.set(false)
|
||||||
|
@ -236,7 +236,7 @@
|
|||||||
|
|
||||||
const { scrollHeight, scrollTop, clientHeight } = scrollElement
|
const { scrollHeight, scrollTop, clientHeight } = scrollElement
|
||||||
|
|
||||||
return Math.ceil(scrollTop + clientHeight) === scrollHeight
|
return scrollHeight - Math.ceil(scrollTop + clientHeight) <= 0
|
||||||
}
|
}
|
||||||
|
|
||||||
let scrollToRestore = 0
|
let scrollToRestore = 0
|
||||||
|
@ -32,6 +32,9 @@
|
|||||||
|
|
||||||
let object: Doc | undefined = undefined
|
let object: Doc | undefined = undefined
|
||||||
|
|
||||||
|
$: if (object?._id !== value.attachedTo) {
|
||||||
|
object = undefined
|
||||||
|
}
|
||||||
$: iconMixin = hierarchy.classHierarchyMixin(value.attachedToClass, view.mixin.ObjectIcon)
|
$: iconMixin = hierarchy.classHierarchyMixin(value.attachedToClass, view.mixin.ObjectIcon)
|
||||||
$: iconMixin &&
|
$: iconMixin &&
|
||||||
query.query(value.attachedToClass, { _id: value.attachedTo }, (res) => {
|
query.query(value.attachedToClass, { _id: value.attachedTo }, (res) => {
|
||||||
|
@ -232,6 +232,7 @@ export class InboxNotificationsClientImpl implements InboxNotificationsClient {
|
|||||||
)
|
)
|
||||||
|
|
||||||
for (const notification of notificationsToRead) {
|
for (const notification of notificationsToRead) {
|
||||||
|
notification.isViewed = true
|
||||||
await client.update(notification, { isViewed: true })
|
await client.update(notification, { isViewed: true })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user