I’ve created a MD entries with the
blankAppState
variable. As in the figure, the format will be
productName:[]…
However, when I tried to modify or add another variable in the blankAppState like ‘productName’:[],‘productID:’[]
, it shows the problem below.
I guess is that the MD entry is already exist so it don’t allow me to create another one. Is there anyway to remove or clear the previous entry that I have created so I can add a new one?
You can update an existing entry with window.safeMutableDataMutation.update
, or remove entries with window.safeMutableDataMutation.remove
1 Like
I just tried with window.safeMutableDataMutation.remove
but at the window.safeMutableData.applyEntriesMutation
part is having this error: error retrieving application state data-100: Core error: Routing client error -> Access denied
.
What is the problem?
You might want to check your permissions to make sure you have delete
permission.
3 Likes
Ya I revoke the access and re-granted with delete permission and that works!
Thank for being patient with me with my “simple question”. I am a beginner to this network so I have a lot of things have to learn.
3 Likes
Is there a way to clear out all the md entries that i find out from window.safeMutableDataEntries.forEach
?
You can populate a mutation transaction object (just like how you are doing it with window.safeMutableDataMutation.remove
) as you iterate the entries, and after the iteration finished you can apply the mutation with applyEntriesMutation
. Bear in mind that when you remove them they are not deleted from the entries but ts/theirs values are cleared, so you cannot insert a new entry with same key but update it.
The code seems working with no errors but when I look up again to all the MD entries they are still there. Why is they not being remove?
All those function calls you are making are async functions, returning a Promise, you need to properly wait for their resolution either with Promise method .then()
or using async / await
.
Sorry I editing the post while you replying… I did add await function and it runs now. I also did applyEntriesMutation
but the data are not being remove as the second image show.
You’ll need to make sure all the calls use await
I still got some error at some certain part but I manually remove them one by one. Anyway thank you!
1 Like