Skip to content
These are temporary community docs. The official docs are in progress.Help improve them
Markless
Esc
↑↓navigate↵open⌘Jpreview
On this page

MARKLESS_COMPONENT_ROOT_CONDITIONAL

A component returns markup from more than one place.

Error from the compiler, while it builds your .tsrx files.

What happened

A component needs one root. This one has a second place that returns markup.

Markless prints the message, the reason, and a suggestion:

MARKLESS_COMPONENT_ROOT_CONDITIONAL: <componentName> has a second template return, so the public render module cannot choose one component root without deleting statement flow.
Initial render executes component bodies, but resume needs one planned root with stable locators. Multiple or conditional template returns need branch records before they can render.
Use a single root with @if/@else inside it, or return null before the one root for a guard clause.
https://markless.dev/errors/MARKLESS_COMPONENT_ROOT_CONDITIONAL

Words in angle brackets change from case to case.

How to fix it

Keep one root and put @if and @else inside it. For an early exit, return null before that root.

Where it comes from

@markless/compiler raises this code. Source:

Read how to read a Markless error, or go back to all error codes.

Was this page helpful?