diff --git a/src/util/entities/Channel.ts b/src/util/entities/Channel.ts index 1fa552b24..611351aa4 100644 --- a/src/util/entities/Channel.ts +++ b/src/util/entities/Channel.ts @@ -704,6 +704,12 @@ export class Channel extends BaseClass { } toJSON(): PublicChannel { + // needed as some CHANNEL_UPDATE event doesn't call the calculatePosition function and doesn't populate + // the position field. Needs to be looked into more + // TODO: Look into when this can be undefined during CHANNEL_UPDATE + if (this.position === undefined) { + this.position = 0; + } return { ...this, last_pin_timestamp: this.last_pin_timestamp?.toISOString(),