mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-26 16:35:39 +00:00
Memoize list entries and wrap model data
This commit is contained in:
@@ -75,13 +75,14 @@ export async function getModel(version: VersionId, id: string): Promise<DataMode
|
||||
}
|
||||
try {
|
||||
const schema = versionData.schemas.get(schemaName)
|
||||
const model = new DataModel(schema)
|
||||
const model = new DataModel(schema, { wrapLists: true, verbose: true })
|
||||
if (Models[id]) {
|
||||
model.reset(Models[id].model.data, false)
|
||||
} else {
|
||||
model.validate(true)
|
||||
model.history = [JSON.stringify(model.data)]
|
||||
}
|
||||
console.log(model.data)
|
||||
Models[id] = { model, version }
|
||||
} catch (e) {
|
||||
throw new Error(`Cannot get generator "${id}" for version "${version}": ${message(e)}`)
|
||||
|
||||
Reference in New Issue
Block a user