Skip to content

Commit

Permalink
fix: class factory included in sort (#6314)
Browse files Browse the repository at this point in the history
## Summary

Starting to sort polyfills after we transform a class into a class
factory sometimes causes unwanted entries in the list of elements to
sort. This fixes it.
  • Loading branch information
tjzel authored Jul 23, 2024
1 parent fb69481 commit a08e2fb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/react-native-reanimated/plugin/build/plugin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/react-native-reanimated/plugin/src/class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ function processClass(

const polyfilledClassAst = getPolyfilledAst(classPath.node, state);

sortPolyfills(polyfilledClassAst);

appendWorkletDirectiveToPolyfills(polyfilledClassAst.program.body);

replaceClassDeclarationWithFactoryAndCall(
polyfilledClassAst.program.body,
className
);

sortPolyfills(polyfilledClassAst);

polyfilledClassAst.program.body.push(returnStatement(identifier(className)));

const factoryFactory = functionExpression(
Expand Down

0 comments on commit a08e2fb

Please sign in to comment.