-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected Object.freeze() - "TypeError: cannot add a new property, js engine: hermes" #5430
Comments
Hey @mark-c-hoffner, thanks for submitting this issue as well as providing a detailed description. Yes, this is an intended behaviour, but this limitation does not only affect For each variable const foo = { bar: { baz: 7 } };
runOnUI(() => {
'worklet';
console.log(foo.bar.baz);
})(); We freeze objects to prevent users from modifying the original object after it was copied to a worklet. There is no reactivity here and it would lead to hard-to-debug issues. foo.bar.baz = 42; // this change wouldn't be reflected in the worklet (use a shared value instead) Thanks for your suggestion to better document this, maybe we'll mention it in the "Troubleshooting" section in our docs or find a way to display a better warning in dev mode instead of the generic one from |
Thank you @tomekzaw for the clarification on the scope of I love the idea of somehow replacing the generic warning from |
You can't modify the object inside `worklet`: software-mansion/react-native-reanimated#5430 (comment)
You can't modify the object inside `worklet`: software-mansion/react-native-reanimated#5430 (comment)
You can't modify the object inside `worklet`: software-mansion/react-native-reanimated#5430 (comment)
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@gorhom/bottom-sheet](https://ui.gorhom.dev/components/bottom-sheet) ([source](https://togithub.com/gorhom/react-native-bottom-sheet)) | [`^4.6.3` -> `^4.6.4`](https://renovatebot.com/diffs/npm/@gorhom%2fbottom-sheet/4.6.3/4.6.4) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@gorhom%2fbottom-sheet/4.6.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@gorhom%2fbottom-sheet/4.6.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@gorhom%2fbottom-sheet/4.6.3/4.6.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@gorhom%2fbottom-sheet/4.6.3/4.6.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>gorhom/react-native-bottom-sheet (@​gorhom/bottom-sheet)</summary> ### [`v4.6.4`](https://togithub.com/gorhom/react-native-bottom-sheet/blob/HEAD/CHANGELOG.md#464-2024-07-29) [Compare Source](https://togithub.com/gorhom/react-native-bottom-sheet/compare/v4.6.3...v4.6.4) ##### Bug Fixes - add missing rest props to backdrop component ([#​1895](https://togithub.com/gorhom/react-native-bottom-sheet/issues/1895))(by [@​hraschan](https://togithub.com/hraschan)) ([6b99810](https://togithub.com/gorhom/react-native-bottom-sheet/commit/6b99810cb9f3a9b11159c27737ef7e4355b105b3)) - assigning to read-only property 'reduceMotion' ([#​1848](https://togithub.com/gorhom/react-native-bottom-sheet/issues/1848))(by [@​pafry7](https://togithub.com/pafry7)) ([efd4e92](https://togithub.com/gorhom/react-native-bottom-sheet/commit/efd4e92b647825aeaf5ca983e43d1a21d620ecfe)), closes [/github.com/software-mansion/react-native-reanimated/issues/5430#issuecomment-1831453991](https://togithub.com//github.com/software-mansion/react-native-reanimated/issues/5430/issues/issuecomment-1831453991) - replace getRefNativeTag with findNodeHandle ([#​1823](https://togithub.com/gorhom/react-native-bottom-sheet/issues/1823))(by [@​AndreiCalazans](https://togithub.com/AndreiCalazans)) ([b906f5e](https://togithub.com/gorhom/react-native-bottom-sheet/commit/b906f5e67afdb823b7c31a9a929e757fc35222a2)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - "after 5pm,every weekend" in timezone America/Los_Angeles, Automerge - "after 5pm,every weekend" in timezone America/Los_Angeles. 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View the [repository job log](https://developer.mend.io/github/valora-inc/wallet). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4yMC4xIiwidXBkYXRlZEluVmVyIjoiMzguMjAuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsibnBtIiwicmVub3ZhdGUiXX0=--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Description
Functions passed to
runOnJS
as the property of an object cause all other properties of that object to be frozen.I did not expect those other properties to be frozen.
If this is intended behavior, a remark on the
runOnJS
docs would be helpful.Steps to reproduce
Snack or a link to a repository
https://github.com/mark-c-hoffner/reanimated-freeze-reproduction
Reanimated version
3.6.0
React Native version
0.72.7
Platforms
Android
JavaScript runtime
Hermes
Workflow
React Native
Architecture
Fabric (New Architecture)
Build type
None
Device
Real device
Device model
moto g(7) play - 9
Acknowledgements
Yes
The text was updated successfully, but these errors were encountered: