Error codesState

A subtree shared() widget has no root

MARKLESS_SHARED_SUBTREE_ROOT_MISSINGerrorMarkless raises it while it builds your .tsrx files.

The message

MARKLESS_SHARED_SUBTREE_ROOT_MISSING: <users> share the subtree value "<definitionName>", but none of them wraps the others, so the build cannot tell where one widget ends.
Each widget root starts its own copy of a subtree value and the parts inside it share that copy. Without a root, every part would start a copy of its own.
Read "<definitionName>" in the component that wraps them<wrapper>, or give it { scope: 'app' } if the whole page should share it.
https://markless.dev/errors/MARKLESS_SHARED_SUBTREE_ROOT_MISSING

Words in angle brackets change from case to case.

Why

A subtree value gets one copy per widget: the widget root starts it and the parts inside share it. The root is the component that uses the value and wraps the other parts, renders them, or sets the starting value. Here every component that uses the value is a part, and the one that wraps them never mentions it, so each part would start a copy of its own.

Fix

Read the value in the component that wraps the parts. Or, if every widget on the page should share one value, give it { scope: 'app' }.

Before

import { shared, state, type Children } from '@markless/core';export const tabs = shared(() => {	const value = state({ open: 'a' });	return value;}, { scope: 'subtree' });export function Tabs({ children }: { children?: Children }) @{	<div>{children}</div>}export function Tab({ name }: { name: string }) @{	<button onClick={() => (tabs.open = name)}>{name}</button>}export function Panel() @{	<section>{tabs.open}</section>}

After

export function Tabs({ open, children }: { open: string; children?: Children }) @{	tabs.open = open;	<div>{children}</div>}
Where Markless raises it

All error codes

Button sounds are from Josh Comeau's Button Sounds library.