Skip to content

[MWPW-190483] Fixing error observed in analytics + console errors on clicking cancel#737

Merged
arugupta1992 merged 5 commits intostagefrom
followups
Apr 9, 2026
Merged

[MWPW-190483] Fixing error observed in analytics + console errors on clicking cancel#737
arugupta1992 merged 5 commits intostagefrom
followups

Conversation

@arugupta1992
Copy link
Copy Markdown
Collaborator

@arugupta1992 arugupta1992 commented Apr 8, 2026

  1. Changed all TransitionScreen instantiation sites to be lazy — only creates a new TransitionScreen instance if one doesn't already exist (if (!this.transitionScreen)). Also fixes a bug where this.transitionScreen.splashScreenEl was used (referencing the old object) instead of this.splashScreenEl, and updates LOADER_LIMIT on the existing instance rather than re-constructing.
  2. Improved error logging to clearly distinguish between different server failures. Currently there were wrong messaging logged for few errors.
  3. Fixed console error on clicking cancel. (EPV)
image

Resolves: MWPW-190483

Test URLs:

@aem-code-sync
Copy link
Copy Markdown

aem-code-sync bot commented Apr 8, 2026

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run PSI checks
  • Re-sync branch
Commits

}
return await this.afterFetchFromService(url, response);
} catch (error) {
if (error) error.message += `, Max retry delay exceeded for URL: ${url}`;
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reason : The catch block unconditionally appends "Max retry delay exceeded" to the error message regardless of whether the polling ever started. If the request failed on the first attempt with no retries then the message "Max retry delay exceeded" is wrong. This makes the analytics log misleading. The fix distinguish between a polling timeout and a first-attempt fetch failure:

}

updateProgressBar(layer, percentage) {
if (!layer) return;
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to guard for the race scenarios where the upload process begins before splashfragment loads.

Trade-off:
Now if the layer (i.e. splashscreen) is null, the workflow will progress to completion but user sees the page normally until the redirect fires as splashscreen was never loaded. This should be acceptable behaviour, since current behaviour blocks the user flow and throws error in this scenario.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really interesting. I would agree that instead of a blocking flow, would be better to still let user be redirected to product.

How common of a case has this been?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is third top error for most of the verbs. First being 401 which is user error so we can call this out the second most impacting error.

const { failedChunks, attemptMap } = result;
const totalChunks = Math.ceil(file.size / blockSize);
if (failedChunks.size > 0) {
if (failedChunks.size > 0 && !signal?.aborted) {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to prevent sending this analytics if workflow was cancelled by user.

try {
response = await fetch(storageUrl, uploadOptions);
} catch (e) {
if (e instanceof TypeError) {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to account for correct error message if it is a network failure.

}
const { default: TransitionScreen } = await import(`${getUnityLibs()}/scripts/transition-screen.js`);
this.transitionScreen = new TransitionScreen(this.transitionScreen.splashScreenEl, this.initActionListeners, this.LOADER_LIMIT, this.workflowCfg, this.desktop);
if (!this.transitionScreen) {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed all TransitionScreen instantiation sites to be lazy — only creates a new TransitionScreen instance if one doesn't already exist (if (!this.transitionScreen)). Also fixes a bug where this.transitionScreen.splashScreenEl was used (referencing the old object) instead of this.splashScreenEl, and updates LOADER_LIMIT on the existing instance rather than re-constructing.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch!

@arugupta1992 arugupta1992 requested review from Ruchika4, sanjayms01 and vipu0303 and removed request for sanjayms01 April 8, 2026 09:18
Comment on lines +351 to +354
if (!this.transitionScreen) {
const { default: TransitionScreen } = await import(`${getUnityLibs()}/scripts/transition-screen.js`);
this.transitionScreen = new TransitionScreen(this.splashScreenEl, this.initActionListeners, this.LOADER_LIMIT, this.workflowCfg, this.desktop);
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on breaking this out to a separate function to remove the redundant lines of code?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, good point. We already have loadTransitionScreen function which does the same. I am not sure why that wasn't being used throughout. I can take this up in my next PR.

@asonnalagi
Copy link
Copy Markdown
Collaborator

Looks fine in branch URL. Test results are in the ticket :MWPW-190483

@arugupta1992 arugupta1992 merged commit 6f10ed2 into stage Apr 9, 2026
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants