Skip to content

Shadowed memo and createElement calls keep the wrong template callback signature #2589

Closed

Description

@domgan-oai

The production compiler leaves a callable template argument in its runtime-rendered form when the call's local name matches an imported memo or createElement, even when a local binding shadows the import. Reproduced with both compiler and runtime from c34035d7d1474b266127382bb0c6bebc22bb6fc6.

import { memo, createElement } from 'octane';

export function MemoExample() @{
  const memo = (render) => render();
  const value = memo(() => @{ <b>memo</b> });
  <main>{value}</main>
}

export function ElementExample() @{
  const createElement = (render) => render();
  const value = createElement(() => @{ <b>element</b> });
  <main>{value}</main>
}

renderToString renders the corresponding <b> element. A client mount through createRoot(container).render(Example) throws Cannot read properties of undefined (reading 'slots') for both exports. The ordinary function should execute the callback and render the element in both environments.

The template-argument exemption currently collects names from the import list and checks the callee spelling. The exemption needs the resolved lexical import. Genuine Octane calls should keep their existing behavior. The distinct portal lowering bug is tracked in #2587.

Codex task · Host com-79386

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions