forked from software-mansion/react-native-reanimated
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get rid of only-value-capture optimization that breaks the world (sof…
…tware-mansion#4060) ## Summary This PR removes a plugin-level optimization that made it so that when using nested variables we'd only capture the most inner value and not the whole object. The reason is that we now allow objects to be proxies in which case this won't work as we'd capture the object field instead of capturing the reference to proxy. An example of such was reported in software-mansion#3967 but we also noticed similar problems when passing host objects. We decided to drop optimization that landed in software-mansion#1174 arguing that shared values after the rewrite are much faster and more reliable hence we can allow for larger objects to be converted even if we only use one or two fields from such objects. In the majority of the cases such conversion will only happen at most once. If this turns out to be problematic in certain use-cases, the individual fields can be extracted by the user before the worklet is defined. In order to make things like Animated module capturable we had to add a dummy implementation for handling symbols – this isn't used anywhere so the dummy implementation just converts symbols into strings for now. Ultimately, symbols would need to have their own registry in order to guarantee referential equality. But since that'd require adding more complex logic and is not going to be used for now I decided to go with that dummy implementation for now instead. ## Test plan Run regular set of examples. Test software-mansion#1051 and verify things like Animated object can be captured (see software-mansion#1132 – but this example is no longer valid as Animated does not have Extrapolate field any longer).
- Loading branch information
Showing
4 changed files
with
19 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters