Skip to content

Commit c28e8d3

Browse files
committed
fix removed event should commit removeItem
When the event is “removed”, it should call the `removeItem` mutation.
1 parent 6287b42 commit c28e8d3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/service-module/make-service-plugin.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,11 @@ export default function prepareMakeServicePlugin(
110110
model: Model,
111111
models: globalModels
112112
})
113-
affectsStore &&
114-
store.dispatch(`${options.namespace}/${mutationName}`, item)
113+
if (affectsStore) {
114+
eventName = 'removed'
115+
? store.commit(`${options.namespace}/removeItem`, item)
116+
: store.dispatch(`${options.namespace}/${mutationName}`, item)
117+
}
115118
}
116119

117120
// Listen to socket events when available.

0 commit comments

Comments
 (0)