Skip to content

Commit

Permalink
Fix the actual bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jameskerr committed Nov 13, 2024
1 parent 8f50cd1 commit df44d87
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions apps/zui/src/js/state/migrations/202409271055_migrateToSnapshots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,23 @@ export default function migrateToSnapshots(appState: any) {
if (!snapshot) {
/* The Snapshot is missing because it has invalid syntax */
/* But it is stored in the queryVersions */
const version = state.queryVersions[queryId].entities[versionId]
/* If it is not stored under the queryId, it is stored under the sessionId. */
const version =
state.queryVersions[queryId].entities[versionId] ||
state.queryVersions[sessionId].entities[versionId]
const isNamed = !!queries[queryId]
snapshot = {
createdAt: version.ts,
updatedAt: version.ts,
id: version.version,
pins: version.pins,
value: version.value,
sessionId: sessionId,
queryId: isNamed ? queryId : null,
if (version) {
snapshot = {
createdAt: version.ts,
updatedAt: version.ts,
id: version.version,
pins: version.pins,
value: version.value,
sessionId: sessionId,
queryId: isNamed ? queryId : null,
}
snapshots.push(snapshot)
}
snapshots.push(snapshot)
}
/* Re-write the path */
const newPath = `/snapshots/${snapshot.id}`
Expand Down

0 comments on commit df44d87

Please sign in to comment.