Skip to content

Commit

Permalink
Gate useEvent handling in ExhaustiveDeps as experimental
Browse files Browse the repository at this point in the history
To keep the test simple, just imperatively only run the test if the
EXPERIMENTAL flag is set.
  • Loading branch information
poteto committed Sep 23, 2022
1 parent 16e669b commit 9550edb
Showing 1 changed file with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1452,18 +1452,6 @@ const tests = {
}
`,
},
{
code: normalizeIndent`
function MyComponent({ theme }) {
const onStuff = experimental_useEvent(() => {
showNotification(theme);
});
useEffect(() => {
onStuff();
}, []);
}
`,
},
],
invalid: [
{
Expand Down Expand Up @@ -7642,6 +7630,21 @@ const tests = {
],
};

if (__EXPERIMENTAL__) {
tests.valid.push({
code: normalizeIndent`
function MyComponent({ theme }) {
const onStuff = experimental_useEvent(() => {
showNotification(theme);
});
useEffect(() => {
onStuff();
}, []);
}
`,
});
}

// Tests that are only valid/invalid across parsers supporting Flow
const testsFlow = {
valid: [
Expand Down

0 comments on commit 9550edb

Please sign in to comment.