Skip to content

Create a debug/trace facility #2

@yuchi

Description

@yuchi

Since this is a macro, there’s little to no way to trace which references are placed in the inputs array.

An initial proposal syntax could be this:

function MyComponent() {
  const { magnitude } = props;
  const [counter, setCounter] = useState();
  const handleClick = useAutoCallback(event => {
    setCounter(counter * magnitude);
  }, trace);
  // ↑↑↑↑↑
}

Which would output (on every render):

MyComponent › handleClick › useAutoCallback inputs: { counter: 0, magnitude: 4 }
  ┬             ┬             ┬                       ─┬──────────────────────
  │             │             │                        │
  │             │             └─ name of the macro     └─ identifier name and
  │             │                                         value for each input
  │             │
  │             └─ eventual name of the resulting variable
  └─ name of the outer significant scope

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions