import { Cell, Default, handler, pattern, UI } from "commonfabric"; declare global { namespace JSX { interface IntrinsicElements { "cf-button": any; } } } const handleClick = handler }>( (_, { count }) => { count.set(count.get() + 1); }, ); // FIXTURE: event-handler-no-compute-wrap // Verifies: handler invocations in JSX are NOT wrapped in a reactive compute // wrapper (formerly derive, now lift-applied post-CT-1615), while // expressions are. // count + 1 (in JSX ) → __cfHelpers.lift<...>(({ count }) => count + 1)({ count }) // handleClick({ count }) (onClick attr) → left as-is (not wrapped) // handleClick({ count }) (inside .map()) → left as-is (not wrapped) // pattern<{ count: Default }> → pattern(fn, inputSchema, outputSchema) // Context: Negative test ensuring handler calls in event attributes and // inside .map() are not wrapped as reactive compute. export default pattern<{ count: Default }>( ({ count }) => { return { [UI]: (
{/* Regular JSX expression - should be wrapped in a lift-applied computation */} Count: {count + 1} {/* Event handler with OpaqueRef - should NOT be wrapped in a lift-applied computation */} Click me {/* Event handler inside map - should NOT be wrapped in a lift-applied computation */} {[1, 2, 3].map((n) => ( Button {n} ))}
), count, }; }, );