#1522·ripple

[Bug]: A test's dynamic tag `flag.value || !flag.value ? Child : null` stops compiling with the next `@tsrx/core` (tsrx-org/tsrx#737)

Author: leonidazCreated Sep 26, 2026Updated Sep 26, 2026
Labelsbug

[!WARNING] Don't start until the @tsrx/core release that includes tsrx-org/tsrx#782 is published. Until then the test compiles, and the change below isn't needed. The change itself works on every @tsrx/core version, so it can go in with the upgrade to that release.

Issue Category

Other

Bug Description

TSRX decided in tsrx-org/tsrx#737 that a dynamic tag expression (<{expr}>) must be an identifier, a member access (props.as, registry[name], items[0]), or a string literal. A non-self-closing element repeats the expression in its closing tag, so anything more is computed above the element. tsrx-org/tsrx#782 implements the rule in @tsrx/core. Any other expression still parses, and is reported as tsrx-dynamic-tag-expression: a normal compile throws it, and collect and loose mode record it.

One Ripple test uses a conditional as a tag, in packages/ripple/tests/client/composite/composite.dynamic-components.test.tsrx (L98-L99):

tsrx
// The tag expression reads `flag`, but always resolves to `Child`.
<{flag.value || !flag.value ? Child : null} n={n.value} />

With the @tsrx/core release that includes tsrx-org/tsrx#782, the file no longer compiles, so none of its 8 tests run. A scan of Ripple's other 228 .tsrx files and its test strings found no other tag that the rule reports.

Reproduction Steps

From a Ripple checkout at 83ed5615968364a077cbd39bc26a74e4d8c12b11, with @tsrx/core overridden to a tsrx checkout of tsrx-org/tsrx#782 in pnpm-workspace.yaml:

yaml
overrides:
  '@tsrx/core': link:/path/to/tsrx/packages/tsrx
bash
pnpm install --ignore-scripts --no-frozen-lockfile
pnpm vitest run --project ripple-client packages/ripple/tests/client/composite/composite.dynamic-components.test.tsrx

Output:

 FAIL  |ripple-client| packages/ripple/tests/client/composite/composite.dynamic-components.test.tsrx [ packages/ripple/tests/client/composite/composite.dynamic-components.test.tsrx ]
Error: A dynamic tag expression must be an identifier, a member access such as `props.as` or `registry[name]`, or a string literal. Compute anything else before the element: `const Tag = c ? Child : Fallback;`, then `<{Tag} />`.
  Plugin: vite-plugin-ripple
  97 |  				};
  98 |  				// The tag expression reads `flag`, but always resolves to `Child`.
  99 |  				<{flag.value || !flag.value ? Child : null} n={n.value} />
     |        ^
 Test Files  1 failed (1)
      Tests  no tests

Suggested fix

The test checks that a dynamic component remounts when its tag expression is evaluated again, even though the result is still Child. So the tag has to read the tracked value itself. A derived value doesn't do it: with const Tag = track(() => (flag.value || !flag.value ? Child : null)); and <{Tag.value} n={n.value} />, the derived value stays Child, nothing is notified, and the test fails with expected '0' to be '1'.

A lookup keyed by a tracked value does it, and a computed key that is a member access is allowed:

diff
 			function App() @{
 				const n = track(0);
-				const flag = track(true);
+				const key = track<'a' | 'b'>('a');
+				const children = { a: Child, b: Child };
 				bump = () => {
 					n.value++;
 				};
 				poke = () => {
-					flag.value = !flag.value;
+					key.value = key.value === 'a' ? 'b' : 'a';
 				};
-				// The tag expression reads `flag`, but always resolves to `Child`.
-				<{flag.value || !flag.value ? Child : null} n={n.value} />
+				// The tag expression reads `key`, but always resolves to `Child`.
+				<{children[key.value]} n={n.value} />
 			}

With this change and the core from tsrx-org/tsrx#782, all 8 tests in the file pass.

Additional Context

  • The rest of ripple-client, ripple-server, tsrx-ripple and ripple-hydration gives the same results with the core from tsrx-org/tsrx#782 as with tsrx main's core.
  • In the editor, the tag is underlined and the rest of the file still works, since collect and loose mode only record the error.

Environment

  • Ripple main at 83ed5615968364a077cbd39bc26a74e4d8c12b11, @tsrx/ripple 0.2.4
  • @tsrx/core from tsrx-org/tsrx#782 (121b65cc), compared with tsrx main (9c2f24f8)
  • Node 24.18.0, macOS 26.6.2

Checklist

  • I've searched for existing issues