make tileClassForEntry optional, as otherwise it is a breaking change

This commit is contained in:
Bruno Windels 2022-04-08 14:19:34 +02:00
parent 5445db2a42
commit a913671f0c
2 changed files with 4 additions and 4 deletions

View File

@ -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;

View File

@ -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);