Skip to content

Commit 2383304

Browse files
committed
fix: store.$getModel should use item.$model
1 parent cbd97d6 commit 2383304

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/core/src/store.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ export async function createStoreCore<
6363
if (modelNames?.length === 1) {
6464
return store.$models.find(m => m.name === modelNames[0]) ?? null
6565
}
66+
if (typeof item?.$model === 'string') {
67+
const result = store.$models.find(m => m.name === item.$model)
68+
if (result) {
69+
return result
70+
}
71+
}
6672
const models = modelNames ? store.$models.filter(m => modelNames?.includes(m.name)) : store.$models
6773
for (const model of models) {
6874
if (model.isInstanceOf(item)) {

0 commit comments

Comments
 (0)