mirror of
https://github.com/outline/outline.git
synced 2026-08-03 13:27:25 +03:00
fix: Empty collaborators displayed on fresh model (#13231)
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user