Skip to content

Make sure changes to SnapRuntimeData are correctly persisted #1633

@FrederikBolding

Description

@FrederikBolding

Since everything in the BaseControllerV2 state is piped to the extension UI, we currently store a few things in memory instead of the regular state. However, the BaseControllerV2 state is only persisted to local storage when an actual state change happens: https://github.com/MetaMask/core/blob/6437c7ad30a3dbcd0cf6ad3dd71d1679c6a76457/packages/base-controller/src/BaseControllerV2.ts#L163

This means that we currently have a bug where users may have data loss.

We should fix this by making sure we always persist any changes to SnapsRuntimeData to disk when the in-memory value is changed.

Metadata

Metadata

Labels

type-bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions