Skip to content

Inspector comment placed in shared component definition instead of call-site page #237

@bailob

Description

@bailob

Summary

When using the Inspector to add a comment on a rendered element that comes from a shared component (e.g. a <Heading> or <PageShell> component defined once in the slide file and reused across multiple pages), the @slide-comment marker is written into the shared component's definition, not the call site.

This means the marker cannot be resolved to a specific page — the agent (or human) reading the marker has no way to determine which page the comment was meant for.

Environment

  • @open-slide/core@1.10.0

Minimal reproduction

const PageShell = ({ children, heading }: { children: React.ReactNode; heading?: string }) => (
  <section>
    {heading ? <h2>{heading}</h2> : null}
    <div>{children}</div>
  </section>
);

const PageA: Page = () => <PageShell heading="Intro">content A</PageShell>;
const PageB: Page = () => <PageShell heading="Details">content B</PageShell>;
  1. Open PageA in the editor.
  2. Use Inspector → click on the <h2> heading → add a comment: "change this title".
  3. Observe: the @slide-comment marker lands inside PageShell definition, not inside PageA.

Actual behavior

The comment lands at the shared component definition. Neither an agent nor a human reading the source can determine which page the comment was targeting. The only workaround is to ask the user which page they were viewing — which breaks the headless apply-comments workflow.

Expected behavior

The comment should be placed in or near the call site (the specific page component) so the target page is unambiguous. If that's not feasible with React's source mapping, the inspector could at minimum warn the user that the element belongs to a shared component and the comment will land at the definition site.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions