fix: Empty collaborators displayed on fresh model (#13231)

This commit is contained in:
Tom Moor
2026-08-01 22:47:49 +00:00
committed by GitHub
parent 13b9b2c62d
commit fd5dfdb47e
2 changed files with 6 additions and 3 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ function Collaborators(props: Props) {
// ensure currently present via websocket are always ordered first
// Memoize collaboratorIds as a Set for efficient lookup
const collaboratorIdsSet = useMemo(
() => new Set(document.collaboratorIds),
() => new Set(document.collaboratorIds ?? []),
[document.collaboratorIds]
);
const collaborators = useMemo(
+5 -2
View File
@@ -181,8 +181,11 @@ export default class Document extends ArchivableModel implements Searchable {
@Relation(() => Document, { onArchive: "cascade", onDelete: "cascade" })
parentDocument?: Document;
/**
* The ids of users that have edited this document.
*/
@observable
collaboratorIds: string[] = [];
collaboratorIds: string[] | undefined;
@Relation(() => User)
createdBy: User | undefined;
@@ -309,7 +312,7 @@ export default class Document extends ArchivableModel implements Searchable {
@computed
get collaborators(): User[] {
return this.collaboratorIds
return (this.collaboratorIds ?? [])
.map((id) => this.store.rootStore.users.get(id))
.filter(Boolean) as User[];
}