Fix bug when selecting method without modeled methods

When selecting a method that has no modeled methods, the modeling state
would not contain an entry for the method signature. This would cause
the `modeledMethods` to be `undefined`, which is not allowed according
to its type.
This commit is contained in:
Koen Vlaswinkel
2023-10-10 15:51:59 +02:00
parent f4d74c7d3f
commit e332b26f29

View File

@@ -330,7 +330,7 @@ export class ModelingStore extends DisposableObject {
databaseItem: dbItem, databaseItem: dbItem,
method, method,
usage, usage,
modeledMethods: dbState.modeledMethods[method.signature], modeledMethods: dbState.modeledMethods[method.signature] ?? [],
isModified: dbState.modifiedMethodSignatures.has(method.signature), isModified: dbState.modifiedMethodSignatures.has(method.signature),
}); });
} }
@@ -349,7 +349,7 @@ export class ModelingStore extends DisposableObject {
return { return {
method: selectedMethod, method: selectedMethod,
usage: dbState.selectedUsage, usage: dbState.selectedUsage,
modeledMethods: dbState.modeledMethods[selectedMethod.signature], modeledMethods: dbState.modeledMethods[selectedMethod.signature] ?? [],
isModified: dbState.modifiedMethodSignatures.has( isModified: dbState.modifiedMethodSignatures.has(
selectedMethod.signature, selectedMethod.signature,
), ),