Skip to content

Commit

Permalink
[compiler] Repro for interaction b/w outlining and idx
Browse files Browse the repository at this point in the history
babel-plugin-idx enforces that its 2nd argument is an arrow function, so
outlining needs to skip over lambdas that are args to idx. This PR adds
a small repro highlighting the issue.

ghstack-source-id: b4627ec552056f33090e2f7bc0536a6006d79d18
Pull Request resolved: #30435
  • Loading branch information
poteto committed Jul 23, 2024
1 parent 695d80f commit 1bfe7fd
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

## Input

```javascript
import idx from 'idx';

function Component(props) {
// the lambda should not be outlined
const groupName = idx(props, _ => _.group.label);
return <div>{groupName}</div>;
}

export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{}],
};

```


## Error

```
The second argument supplied to `idx` must be an arrow function. (This is an error on an internal node. Probably an internal error.)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import idx from 'idx';

function Component(props) {
// the lambda should not be outlined
const groupName = idx(props, _ => _.group.label);
return <div>{groupName}</div>;
}

export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{}],
};

0 comments on commit 1bfe7fd

Please sign in to comment.