You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to take the last N elements of a Shared Value array, but calling .slice throws an error.
Reproducable code:
constarray=useSharedValue<number[]>([1,2,3]);array.value.slice(1);// throws "Error: array.value.slice is not a function (it is undefined)"
I believe this is because the .slice function was not implemented in #36. Is there any way for me to either extend this functionality into the proxy in my code base or to use something else?
For additional context, I'm trying to add data to this array from inside a Vision Camera Skia frame processor, and then also in the frame processor I'm rendering the last 1000 data points in a graph. To get around using .slice, I've been calling Object.values(array.value) and then running .slice on the output array. However, for large arrays (1000+ items), this because very inefficient (20+ ms). I'm also open to suggestions for alternate strategies for doing this if it would be too difficult to extend the functionality.
Thanks!
The text was updated successfully, but these errors were encountered:
I'm trying to take the last N elements of a Shared Value array, but calling
.slice
throws an error.Reproducable code:
I believe this is because the
.slice
function was not implemented in #36. Is there any way for me to either extend this functionality into the proxy in my code base or to use something else?For additional context, I'm trying to add data to this array from inside a Vision Camera Skia frame processor, and then also in the frame processor I'm rendering the last 1000 data points in a graph. To get around using
.slice
, I've been callingObject.values(array.value)
and then running.slice
on the output array. However, for large arrays (1000+ items), this because very inefficient (20+ ms). I'm also open to suggestions for alternate strategies for doing this if it would be too difficult to extend the functionality.Thanks!
The text was updated successfully, but these errors were encountered: