Skip to content

Commit 3cc581e

Browse files
v0.6.71: build error fix
2 parents 5ea80a8 + 49713f8 commit 3cc581e

1 file changed

Lines changed: 24 additions & 18 deletions

File tree

apps/sim/lib/workflows/migrations/subblock-migrations.ts

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -97,25 +97,31 @@ function migrateBlockSubblockIds(
9797
continue
9898
}
9999

100-
const oldEntry = result[oldId]
100+
const oldEntry: unknown = result[oldId]
101101
const configuredType = blockConfig?.subBlocks?.find((config) => config.id === newId)?.type
102-
result[newId] = isPlainRecord(oldEntry)
103-
? {
104-
...oldEntry,
105-
id: newId,
106-
type:
107-
configuredType ||
108-
(typeof oldEntry.type === 'string' && oldEntry.type.length > 0
109-
? oldEntry.type === 'unknown'
110-
? DEFAULT_SUBBLOCK_TYPE
111-
: oldEntry.type
112-
: DEFAULT_SUBBLOCK_TYPE),
113-
}
114-
: ({
115-
id: newId,
116-
type: configuredType || DEFAULT_SUBBLOCK_TYPE,
117-
value: oldEntry,
118-
} as BlockState['subBlocks'][string])
102+
if (isPlainRecord(oldEntry)) {
103+
const type =
104+
configuredType ||
105+
(typeof oldEntry.type === 'string' && oldEntry.type.length > 0
106+
? oldEntry.type === 'unknown'
107+
? DEFAULT_SUBBLOCK_TYPE
108+
: oldEntry.type
109+
: DEFAULT_SUBBLOCK_TYPE)
110+
const value = Object.hasOwn(oldEntry, 'value') ? oldEntry.value : null
111+
112+
result[newId] = {
113+
...oldEntry,
114+
id: newId,
115+
type: type as BlockState['subBlocks'][string]['type'],
116+
value: value as BlockState['subBlocks'][string]['value'],
117+
}
118+
} else {
119+
result[newId] = {
120+
id: newId,
121+
type: configuredType || DEFAULT_SUBBLOCK_TYPE,
122+
value: oldEntry as BlockState['subBlocks'][string]['value'],
123+
}
124+
}
119125
delete result[oldId]
120126
}
121127

0 commit comments

Comments
 (0)