diff --git a/package.json b/package.json index a4a8b86..ae75442 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "processout.js", - "version": "1.9.3", + "version": "1.9.4", "description": "ProcessOut.js is a JavaScript library for ProcessOut's payment processing API.", "scripts": { "build:processout": "tsc -p src/processout && uglifyjs --compress --keep-fnames --ie8 dist/processout.js -o dist/processout.js", diff --git a/src/apm/Page.ts b/src/apm/Page.ts index 0fc6b1c..f8615a2 100644 --- a/src/apm/Page.ts +++ b/src/apm/Page.ts @@ -55,6 +55,7 @@ module ProcessOut { (request.bind(APIImpl) as APIRequest)({ hasConfirmedPending, onSuccess: ({ elements, ...config }) => { + const previousState = this.state this.state = config.state callback && callback(null, this.state); @@ -73,7 +74,13 @@ module ProcessOut { } if (config.state === 'PENDING') { - ContextImpl.context.page.render(APMViewPending, { elements, config }) + // Only render on the transition INTO PENDING. Background polling responses + // (PENDING → PENDING) must not re-render — that would unmount the Pending view, + // wiping displayed instructions/QR codes and resetting the countdown timer (see + // Pending.ts componentWillUnmount removing pending.startTime). + if (previousState !== 'PENDING') { + ContextImpl.context.page.render(APMViewPending, { elements, config }) + } } }, onError: ({ elements, ...config }) => {