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_TRY_BLOCK_TOGGLE_RERENDER

Toggling an @if that holds a component re-renders the whole @try block.

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

What happened

This @if sits inside @try and holds a component. When it toggles, Markless renders the whole @try block again, not only the @if.

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

MARKLESS_TRY_BLOCK_TOGGLE_RERENDER: Toggling this <branchLabel> re-renders the whole @try block
Content with a component cannot be rebuilt from static parts and value slots, so the toggle falls back to re-rendering the whole @try block. That works, but it re-runs the component and replaces DOM the toggle did not touch.
Move the component outside the <branchLabel>, or keep the <branchLabel> content to plain elements, text, and state reads.
https://markless.dev/errors/MARKLESS_TRY_BLOCK_TOGGLE_RERENDER

Words in angle brackets change from case to case.

How to fix it

Move the component out of the @if. Or keep the @if content to plain elements, text, and state reads.

If you accept the warning on purpose, put this comment on the line above it:

// markless-allow MARKLESS_TRY_BLOCK_TOGGLE_RERENDER: the reason you accept it

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?