From d0b645cf6ec60f5e893948e6bbdf67e096d33411 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 20 Jan 2022 11:26:43 +0000 Subject: [PATCH] Fix recursion issue with applying API method patches --- packages/frontend-core/src/api/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/frontend-core/src/api/index.js b/packages/frontend-core/src/api/index.js index 3632670dce..6f321307ae 100644 --- a/packages/frontend-core/src/api/index.js +++ b/packages/frontend-core/src/api/index.js @@ -179,8 +179,9 @@ export const createAPIClient = config => { const patches = Object.entries(config.patches || {}) if (patches.length) { patches.forEach(([method, fn]) => { + const baseFn = API[method] API[method] = async (...params) => { - const output = await API[method](...params) + const output = await baseFn(...params) return await fn({ params, output }) } })