fix(): Transform map (#13655)
**What** It seems that for some reason the weak map fail in some scenario, but after investigation, the usage of map would not have a bad impact as it will be released after the Distributed transaction if finished. Therefore, falling back to Map instead FIXES https://github.com/medusajs/medusa/issues/13654 NOTE: Waiting for the user feedback as he is also using node 18. We also use the exact same pattern in all our core flows without issues 🤔
This commit is contained in:
@@ -170,7 +170,7 @@ export function transform(
|
||||
} as WorkflowData & {
|
||||
__id: string
|
||||
__type: string
|
||||
__temporary_storage_key: { key: string } | null
|
||||
__temporary_storage_key: string | null
|
||||
}
|
||||
|
||||
const returnFn = async function (
|
||||
@@ -179,8 +179,7 @@ export function transform(
|
||||
): Promise<any> {
|
||||
if ("transaction" in transactionContext) {
|
||||
const temporaryDataKey = `${transactionContext.transaction.modelId}_${transactionContext.transaction.transactionId}_${uniqId}`
|
||||
|
||||
ret.__temporary_storage_key ??= { key: temporaryDataKey }
|
||||
ret.__temporary_storage_key ??= temporaryDataKey
|
||||
|
||||
if (
|
||||
transactionContext.transaction.hasTemporaryData(
|
||||
|
||||
Reference in New Issue
Block a user