Skip to content

Allow empty template results? #168

Closed
@43081j

Description

@43081j

Currently moving over to lit straight from polymer 2, we commonly have:

if (!this.prop) {
  return html``;
}
return html`some content`;

Is it worth us allowing a null return type in render so we can have an empty template?

and inside lit, keep an emptyTemplate constant which is re-used (if needed)?

so we can have render(): TemplateResult|null?

edit:

having thought again about this, in reality it is probably less efficient to have null checks in the core. i guess the only solution to this would be to have an EmptyTemplate constant which is an already new'd up template result.

cc @justinfagnani

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions