fix: Issue introduced when document.editorVersion is null (#10352)

This commit is contained in:
Tom Moor authored and GitHub committed 2025-10-12 13:52:45 -04:00
1 parent 76868a3083
commit bb72774f2d
3 files changed
+14 -6

No files matched your search

@@ -72,16 +72,24 @@ export default async function documentCollaborativeUpdater({
...pudIds,
]);
// Either the client or server version could be null, or they could both be
// set. In that case we want to use the greater (newer) version.
const editorVersion =
document.editorVersion && clientVersion
? semver.gt(clientVersion, document.editorVersion)
? clientVersion
: document.editorVersion
: clientVersion
? clientVersion
: document.editorVersion;
await document.update(
{
content,
state: Buffer.from(state),
lastModifiedById,
collaboratorIds,
editorVersion:
clientVersion && semver.gt(clientVersion, document.editorVersion)
? clientVersion
: document.editorVersion,
editorVersion,
},
{
transaction,
+1 -1
View File
@@ -315,7 +315,7 @@ class Document extends ArchivableModel<
msg: `editorVersion must be 255 characters or less`,
})
@Column
editorVersion: string;
editorVersion: string | null;
/** An icon to use as the document icon. */
@Length({
+1 -1
View File
@@ -48,7 +48,7 @@ class Revision extends ParanoidModel<
})
@Column
@SkipChangeset
editorVersion: string;
editorVersion: string | null;
/** The document title at the time of the revision */
@Length({