[Suggestion] Can proxying be optional?
Thank you for creating such a great library! Recently, while working on my project, I realized that using proxied objects is not always the best approach. I understand that there are pros and cons to using proxied objects versus plain objects. However, in my case, using proxied objects led to more mistakes and took me a long time to figure out why. For example, when using a proxied array, it failed the Array.isArray test, and I couldn't use functions like Object.entries or Object.keys on it. This made it more challenging to write code than with ordinary functions.
I acknowledge that there may be many cases where proxying is useful, which I may not have encountered yet. However, I was wondering if it would be possible to make proxying optional in your library. I am not familiar with the specifics of your implementation, so I am uncertain if this is feasible or not. Nevertheless, if it is possible, having the option to turn off proxying would be beneficial.
Are you talking about Shared Values in Worklets? Those are Proxies?
Yes. I was referring to this change https://github.com/chrfalch/react-native-worklets/commit/54ea83c57dcf1f8a8eecdfa1ec27eb1beb69e991. Actually, I noticed that it uses Proxy from your response here(see the last paragraph).
I've also had this issue recently when trying to use .slice on a shared value array. Were you ever able to figure out how to get around this or how to extend the proxied object with implementations you needed?
You can reconstruct an array and use it in the JS thread. I agree that it's not satisfying.
Thanks for the suggestion. I tried using Object.values(array) but it was running a bit too slow for my frame processor so I ended up handling all of my skia logic natively instead of trying to pass the values back to JS land and use a shared value.
Ah yes well you can copy the values using spread, but other than that I personally always prefer to use the native Array / Object proxies. They have locking mechanism, which is useful for Skia Frame Processors for example.