fix(orchestrator): inject only if it has decorator (#6666)
This commit is contained in:
committed by
GitHub
parent
d48c076b77
commit
a8794d48de
5
.changeset/smart-spoons-sniff.md
Normal file
5
.changeset/smart-spoons-sniff.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@medusajs/orchestration": patch
|
||||
---
|
||||
|
||||
Inject context only if method use decorator @MedusaContext
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
MedusaContextType,
|
||||
MedusaModuleType,
|
||||
createMedusaContainer,
|
||||
isDefined,
|
||||
} from "@medusajs/utils"
|
||||
import { asValue } from "awilix"
|
||||
import {
|
||||
@@ -90,11 +91,10 @@ export class LocalWorkflow {
|
||||
}
|
||||
|
||||
return async (...args) => {
|
||||
const ctxIndex =
|
||||
MedusaContext.getIndex(target, prop as string) ?? args.length - 1
|
||||
const ctxIndex = MedusaContext.getIndex(target, prop as string)
|
||||
|
||||
const hasContext = args[ctxIndex]?.__type === MedusaContextType
|
||||
if (!hasContext) {
|
||||
const hasContext = args[ctxIndex!]?.__type === MedusaContextType
|
||||
if (!hasContext && isDefined(ctxIndex)) {
|
||||
const context = this_.medusaContext
|
||||
if (context?.__type === MedusaContextType) {
|
||||
delete context?.manager
|
||||
|
||||
Reference in New Issue
Block a user