We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f83aeff commit 2d5ed4aCopy full SHA for 2d5ed4a
packages/dashboard/src/usePersistentState.ts
@@ -16,6 +16,17 @@ export type PersistentStateMigration = {
16
migrate: (state: unknown) => unknown;
17
};
18
19
+/**
20
+ * Migrates persisted state to the provided version using the provided migrations.
21
+ *
22
+ * @param state The current state
23
+ * @param from The current version
24
+ * @param to The version to migrate to
25
+ * @param migrations The list of all migrations (may include those already applied)
26
+ * @param type The type of the state. Used for better error messages
27
+ * @returns The state at the new version
28
+ * @throws Error if trying to migrate backwards or no migration exists for the to version
29
+ */
30
function migrateState(
31
state: unknown,
32
from: number,
0 commit comments