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
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is.
Given the following tree navigation store in the Storage:
constnavigationTree=[{"id": "nav0","order": 0,"name": "nav0","parentId": null,"children": [{"id": "nav0.0","order": 0,"name": "nav0.0","parentId": "nav0","children": [{"id": "nav0.0.0","order": 0,"name": "nav0.0.0","parentId": "nav0.0","children": [// N elements]},{"id": "nav0.0.1","order": 1,"name": "nav0.0.1","parentId": "nav0.0","children": [// N elements]},// N elements]},// N elements]}// N elements]
The user can move each element to any position within the tree. When this happens, for the elements that need it, the order property must be updated.
This generates that N elements within the tree have to be updated at the same time.
The current behavior is that you can only update items one by one. This can lead to race conditions.
Describe the solution you'd like
Have the ability that no operations performed were saved in Storage until a commit of the operations was made, and be able to rollback all before operation if an error occur.
First solucion
asyncfunctiontransactionalFunction(roomId, ...args){constroom=this.client.getRoom(roomId)conststorage=room.getStorage()constnavigationTree=storage.root.get('navigationTree')try{// perform several operations (set, update, ...)storage.commit()}catch(e){storage.roolback()}}
Second solution
asyncfunctiontransactionalFunction(roomId, ...args){constroom=this.client.getRoom(roomId)conststorage=room.getStorage()// Automatically commit all operation inside when the callback is finished or rollback if an error occurstorage.transaction((root)=>{constnavigationTree=root.get('navigationTree')// perform several operations (set, update, ...)})}
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is.
Given the following tree navigation store in the Storage:
The user can move each element to any position within the tree. When this happens, for the elements that need it, the order property must be updated.
This generates that N elements within the tree have to be updated at the same time.
The current behavior is that you can only update items one by one. This can lead to race conditions.
Describe the solution you'd like
Have the ability that no operations performed were saved in Storage until a commit of the operations was made, and be able to rollback all before operation if an error occur.
First solucion
Second solution
The text was updated successfully, but these errors were encountered: