fix(dui): stale load settings to existing model card (#94)
Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
This commit is contained in:
@@ -178,21 +178,25 @@ const selectVersionAndAddModel = async (
|
|||||||
|
|
||||||
if (existingModel) {
|
if (existingModel) {
|
||||||
emit('close')
|
emit('close')
|
||||||
// Patch the existing model card with new versions!
|
const patchPayload: Record<string, unknown> = {
|
||||||
await hostAppStore.patchModel(existingModel.modelCardId, {
|
|
||||||
selectedVersionId: version.id,
|
selectedVersionId: version.id,
|
||||||
selectedVersionSourceApp: version.sourceApplication,
|
selectedVersionSourceApp: version.sourceApplication,
|
||||||
selectedVersionUserId: version.authorUser?.id,
|
selectedVersionUserId: version.authorUser?.id,
|
||||||
latestVersionId: latestVersion.id,
|
latestVersionId: latestVersion.id,
|
||||||
latestVersionSourceApp: latestVersion.sourceApplication,
|
latestVersionSourceApp: latestVersion.sourceApplication,
|
||||||
latestVersionUserId: latestVersion.authorUser?.id
|
latestVersionUserId: latestVersion.authorUser?.id
|
||||||
})
|
}
|
||||||
|
|
||||||
|
// apply new settings to the existing model card if they were changed
|
||||||
|
if (settingsWereChanged.value && receieveSettings.value) {
|
||||||
|
patchPayload.settings = receieveSettings.value
|
||||||
|
}
|
||||||
|
|
||||||
|
// patch the existing model card with new versions and settings
|
||||||
|
await hostAppStore.patchModel(existingModel.modelCardId, patchPayload)
|
||||||
await hostAppStore.receiveModel(existingModel.modelCardId, 'Wizard')
|
await hostAppStore.receiveModel(existingModel.modelCardId, 'Wizard')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// We were tracking the source host app wrong before `getHostAppFromString`
|
|
||||||
// i.e. we were having `Revit 2023` instead of `revit`
|
|
||||||
const selectedVersionSourceApp = getSlugFromHostAppNameAndVersion(
|
const selectedVersionSourceApp = getSlugFromHostAppNameAndVersion(
|
||||||
version.sourceApplication as string
|
version.sourceApplication as string
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user