Conversation
1a5e22a to
d494108
Compare
|
Hey, Marco! Thanks for putting this down. I wouldn't merge this for now, as the issue isn't pressing and I will introduce some pre-requisite logic that we could then reuse in the If you don't mind, let's put this on hold for the time being, and once the persistence lands, let's see what we can reuse. |
|
A bit late but I would like to suggest a slightly change to the api import { factory, snapshot } from '@mswjs/data'
const db = factory({...})
// ...
// Set up some initial data
// ...
// Take a snapshot of all the entities in the DB and store it in a variable.
const applySnapshotWithInitialData = snapshot(db)
// Restores the DB to the previously taken snapshot.
applySnapshotWithInitialData(db)I think this will make a little more clear where the snapshot is applied to. Additionally it would enable us to create multiple instances and apply the snapshot to those as long as they have the same signature. One may call it copy-and-paste. |
Released: v1.0.0 🎉This has been released in v1.0.0. Get these changes by running the following command: Predictable release automation by Release. |
This is a first implementation of the snapshot utility. This will be updated after the implementation of the storage.
close #86