From a913671f0c93a1760dee5d12669b3cc13737a9d4 Mon Sep 17 00:00:00 2001 From: Bruno Windels <274386+bwindels@users.noreply.github.com> Date: Fri, 8 Apr 2022 14:19:34 +0200 Subject: [PATCH] make tileClassForEntry optional, as otherwise it is a breaking change --- src/domain/session/room/RoomViewModel.js | 5 ++++- src/platform/web/main.js | 3 --- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/domain/session/room/RoomViewModel.js b/src/domain/session/room/RoomViewModel.js index 9c3f468e..66042ae5 100644 --- a/src/domain/session/room/RoomViewModel.js +++ b/src/domain/session/room/RoomViewModel.js @@ -20,6 +20,9 @@ import {ComposerViewModel} from "./ComposerViewModel.js" import {avatarInitials, getIdentifierColorNumber, getAvatarHttpUrl} from "../../avatar"; import {ViewModel} from "../../ViewModel"; import {imageToInfo} from "../common.js"; +// TODO: remove fallback so default isn't included in bundle for SDK users that have their custom tileClassForEntry +// this is a breaking SDK change though to make this option mandatory +import {tileClassForEntry as defaultTileClassForEntry} from "./timeline/tiles/index"; export class RoomViewModel extends ViewModel { constructor(options) { @@ -27,7 +30,7 @@ export class RoomViewModel extends ViewModel { const {room, tileClassForEntry} = options; this._room = room; this._timelineVM = null; - this._tileClassForEntry = tileClassForEntry; + this._tileClassForEntry = tileClassForEntry ?? defaultTileClassForEntry; this._tileOptions = undefined; this._onRoomChange = this._onRoomChange.bind(this); this._timelineError = null; diff --git a/src/platform/web/main.js b/src/platform/web/main.js index 9e1ca85e..1729c17c 100644 --- a/src/platform/web/main.js +++ b/src/platform/web/main.js @@ -18,7 +18,6 @@ limitations under the License. // import {RecordRequester, ReplayRequester} from "./matrix/net/request/replay"; import {RootViewModel} from "../../domain/RootViewModel.js"; import {createNavigation, createRouter} from "../../domain/navigation/index.js"; -import {tileClassForEntry} from "../../domain/session/room/timeline/tiles/index"; // Don't use a default export here, as we use multiple entries during legacy build, // which does not support default exports, // see https://github.com/rollup/plugins/tree/master/packages/multi-entry @@ -43,8 +42,6 @@ export async function main(platform) { // so we call it that in the view models urlCreator: urlRouter, navigation, - // which tiles are supported by the timeline - tileClassForEntry }); await vm.load(); platform.createAndMountRootView(vm);