Skip to content

Commit ac4fa3f

Browse files
Add comment
1 parent dd60a65 commit ac4fa3f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/snaps-rpc-methods/src/permitted/setState.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ async function setStateImplementation(
182182

183183
const mutex = getMutex(snapId);
184184

185+
// The expectation when using `snap_setState` is for the operation to safe
186+
// to do in parallel. The mutex ensures that and prevents a bug that was
187+
// mostly prevalent on mobile and caused data loss.
185188
await mutex.runExclusive(async () => {
186189
const newState = await getNewState(key, value, encrypted, getSnapState);
187190

0 commit comments

Comments
 (0)