0

What i'm trying to do

I want to go through one array, create another array that represents mapping by index, save it in Local Storage, and then when the app first mounts to check if there is a value stored in Local storage, and if so then sort the array of data coming from the store (as Proxy) So that they are displayed according to the mapping in LocalStorage.

Hope the explanation is clear :)

I got the data from store as a Proxy like so:

const chocolates = machineStore?.SubsystemsInfo

when i console it out, i need to stringify and parse it so i can view it in the console. it look like so:

enter image description here

When the component mounts, i get the array of mapped indexes from LocalStorage, but the problem now is that i need to render the original array based on it and i cant because it's a Proxy and i cant get access to the array itself, so i can then sort.

enter image description here

how can i convert the data to a regular array so i can work with it ?

i already tried spreading, and parsing so it brings am empty array.

any ideas what do i miss?

Thanx

Tamiross
  • 99
  • 2
  • 10
  • Does this answer your question? [How to get the target of a JavaScript Proxy?](https://stackoverflow.com/questions/51096547/how-to-get-the-target-of-a-javascript-proxy) – pilchard Jun 14 '22 at 07:59
  • Maybe you can make small repro on https://codesandbox.io? It's not very clear what is the problem – Danila Jun 14 '22 at 08:21

0 Answers0