redux-saga-final-form
Advanced tools
Comparing version 2.1.0-4 to 2.1.0-5
@@ -7,2 +7,3 @@ "use strict"; | ||
const promiseMap = new Map(); | ||
const finalFormPromiseId = Symbol('finalFormPromiseId'); | ||
function useListener(startActionType, resolveActionType, rejectActionType, setPayload) { | ||
@@ -17,3 +18,3 @@ const dispatch = react_redux_1.useDispatch(); | ||
meta: { | ||
final_form_promise: promiseId, | ||
[finalFormPromiseId]: promiseId, | ||
final_form_resolve: resolveActionType, | ||
@@ -32,3 +33,3 @@ final_form_reject: rejectActionType, | ||
return next => action => { | ||
if (action.meta?.final_form_promise) { | ||
if (action.meta?.[finalFormPromiseId]) { | ||
if (!pendingCallbacks.has(action.meta.final_form_resolve)) { | ||
@@ -41,10 +42,10 @@ pendingCallbacks.set(action.meta.final_form_resolve, []); | ||
pendingCallbacks.get(action.meta.final_form_resolve).push({ | ||
callback: promiseMap.get(action.meta.final_form_promise).resolve, | ||
callback: promiseMap.get(action.meta[finalFormPromiseId]).resolve, | ||
toClear: action.meta.final_form_reject, | ||
}); | ||
pendingCallbacks.get(action.meta.final_form_reject)?.push({ | ||
callback: promiseMap.get(action.meta.final_form_promise).reject, | ||
callback: promiseMap.get(action.meta[finalFormPromiseId]).reject, | ||
toClear: action.meta.final_form_resolve | ||
}); | ||
promiseMap.delete(action.meta.final_form_promise); | ||
promiseMap.delete(action.meta[finalFormPromiseId]); | ||
} | ||
@@ -51,0 +52,0 @@ const cbInfos = pendingCallbacks.get(action.type); |
{ | ||
"name": "redux-saga-final-form", | ||
"version": "2.1.0-4", | ||
"version": "2.1.0-5", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -16,2 +16,4 @@ import { useDispatch, useStore } from 'react-redux'; | ||
const finalFormPromiseId = Symbol('finalFormPromiseId'); | ||
export function useListener(startActionType: string, resolveActionType: string, rejectActionType: string, setPayload?: (payload: any) => Object) { | ||
@@ -26,3 +28,3 @@ const dispatch = useDispatch(); | ||
meta: { | ||
final_form_promise: promiseId, | ||
[finalFormPromiseId]: promiseId, | ||
final_form_resolve: resolveActionType, | ||
@@ -42,3 +44,3 @@ final_form_reject: rejectActionType, | ||
return next => action => { | ||
if (action.meta?.final_form_promise) { | ||
if (action.meta?.[finalFormPromiseId]) { | ||
if (!pendingCallbacks.has(action.meta.final_form_resolve)) { | ||
@@ -51,10 +53,10 @@ pendingCallbacks.set(action.meta.final_form_resolve, []); | ||
pendingCallbacks.get(action.meta.final_form_resolve)!.push({ | ||
callback: promiseMap.get(action.meta.final_form_promise)!.resolve, | ||
callback: promiseMap.get(action.meta[finalFormPromiseId])!.resolve, | ||
toClear: action.meta.final_form_reject, | ||
}) | ||
pendingCallbacks.get(action.meta.final_form_reject)?.push({ | ||
callback: promiseMap.get(action.meta.final_form_promise)!.reject, | ||
callback: promiseMap.get(action.meta[finalFormPromiseId])!.reject, | ||
toClear: action.meta.final_form_resolve | ||
}); | ||
promiseMap.delete(action.meta.final_form_promise) | ||
promiseMap.delete(action.meta[finalFormPromiseId]) | ||
} | ||
@@ -61,0 +63,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13331
185