Throw if viewClass returns undefined

This commit is contained in:
RMidhunSuresh 2022-01-06 22:17:31 +05:30
parent b134fa7409
commit 273c44424f

View file

@ -24,9 +24,11 @@ export class ReplyPreviewView extends TemplateView {
} }
_renderReplyPreview(t, vm) { _renderReplyPreview(t, vm) {
// todo: this should probably be called viewClassForTile instead
const viewClass = viewClassForEntry(vm); const viewClass = viewClassForEntry(vm);
const view = new viewClass(vm, { reply: true, interactive: false }); const view = new viewClass(vm, { reply: true, interactive: false });
if (!view) {
throw new Error(`Shape ${vm.shape} is unrecognized.`)
}
const rendered = t.view(view); const rendered = t.view(view);
return this._renderReplyHeader(t, vm, [rendered]); return this._renderReplyHeader(t, vm, [rendered]);
} }