Easy upload bug bash#394
Conversation
commit 0b01a11670598340c74e5fd6d1363aaa2ff7548a
Author: Eric Chen <159481679+echen-adobe@users.noreply.github.com>
Date: Mon Apr 20 11:52:16 2026 -0500
refactor
This reverts commit 841a4c0.
|
Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
|
meganthecoder
left a comment
There was a problem hiding this comment.
Also missing unit tests on resetUploadSession, refreshEasyUploadQrIfConsumed, and bindEasyUploadSdkInitListener
|
Thanks for the catch @meganthecoder , requesting another review now. |
fullcolorcoder
left a comment
There was a problem hiding this comment.
Left some suggested code for adding replaceKey and a callout on tests
| `[EasyUpload-UI] Deferred initialization failed: ${error?.message || error}`, | ||
| { severity: 'error' }, | ||
| ); | ||
| showErrorToast?.(block, 'Failed to initialize QR code upload.'); |
There was a problem hiding this comment.
const errorMsg = await replaceKey('qr-init-failed', getConfig());
showErrorToast?.(block, errorMsg || 'Failed to initialize QR code upload.');
// (add matching key to placeholders dict)
| `[EasyUpload-UI] initializeQRCode failed: ${error?.name} ${error?.message}`, | ||
| { severity: 'error' }, | ||
| ); | ||
| showErrorToast?.(block, 'Failed to load QR code.'); |
There was a problem hiding this comment.
const errorMsg = await replaceKey('qr-init-failed', getConfig());
showErrorToast?.(block, errorMsg || 'Failed to load QR code.');
// (add matching key to placeholders dict)
| const block = buildEasyUploadBlock(); | ||
| sinon.stub(EasyUpload.prototype, 'initializeQRCode').resolves(); | ||
| sinon.stub(EasyUpload.prototype, 'startUploadDetectionPolling'); | ||
| const resetUploadSessionStub = sinon.stub(EasyUpload.prototype, 'resetUploadSession').resolves(); |
There was a problem hiding this comment.
The resetUploadSession test only confirms the method is called (stubbed), not what it does. Since this clears timers and resets flags on a user-triggered back-nav path, a test on the actual behavior would give you a safety net if the internals change. Not a merge blocker, but worth a follow-up if you don't have time.
it('resetUploadSession clears polling intervals and resets upload state', async () => {
const easyUpload = createInstance();
easyUpload.qrRefreshInterval = setTimeout(() => {}, 10000);
easyUpload.pollingInterval = setInterval(() => {}, 10000);
easyUpload.uploadFinalized = true;
easyUpload.uploadDetected = true;
sinon.stub(easyUpload, 'stopUploadDetectionPolling');
sinon.stub(easyUpload, 'cleanupAcpStorage').resolves();
await easyUpload.resetUploadSession();
expect(easyUpload.qrRefreshInterval).to.be.null;
expect(easyUpload.pollingInterval).to.be.null;
expect(easyUpload.uploadFinalized).to.be.false;
expect(easyUpload.uploadDetected).to.be.false;
});
This reverts commit c4f93d0.
Summary
Briefly describe the features or fixes introduced in this PR.
Fix the back button of the easy upload widget not working after 1 upload.
Refactored code to be more readable.
Jira Ticket
Resolves: https://jira.corp.adobe.com/browse/MWPW-193429
Test URLs
Verification Steps
Additional Notes
(If applicable) Add context, related PRs, or known issues here.