Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught (in promise) error when rejecting modal's beforeClose() promise #6381

Closed
nwhittaker opened this issue Jan 30, 2023 · 2 comments
Closed
Assignees
Labels
4 - verified Issues that have been released and confirmed resolved. ArcGIS Field Apps Issues logged by ArcGIS Field Apps team members. bug Bug reports for broken functionality. Issues should include a reproduction of the bug. estimate - 3 A day or two of work, likely requires updates to tests. p - low Issue is non core or affecting less that 10% of people using the library

Comments

@nwhittaker
Copy link
Contributor

Actual Behavior

Returning a rejected promise from a modal's beforeClose() callback causes an Uncaught (in promise) error to be logged in the devtools console.

Expected Behavior

Returning a rejected promise from a modal's beforeClose() callback does not log an error.

Reproduction Sample

https://codepen.io/nwhittaker-esri/pen/dyjqzqP

Reproduction Steps

  1. Visit the pen and open the browser's dev tools (not CodePen's).
  2. Close the modal.
  3. See an error is logged to the dev tool's console tab.

Reproduction Version

1.0.3

Relevant Info

Stack trace:

index.html:1 Uncaught (in promise) undefined
Promise.then (async)
close                            @ p-7cb32fff.entry.js:6

Regression?

No response

Impact

The modal's beforeClose() callback is an affective way to cancel closing a modal if some precondition is not met. For example, the Field Maps web app has some modals that may need to confirm some data loss before closing. If the user ends up not confirming, the modal should not close. This flow is achievable by having the beforeClose() callback return a rejected promise.

In this scenario, the rejected promise does not represent an exceptional state. Not catching it introduces a couple problems:

  1. Muddies error logging.
  2. Can cause automated tests to fail.

Esri team

ArcGIS Field Apps

@nwhittaker nwhittaker added bug Bug reports for broken functionality. Issues should include a reproduction of the bug. 0 - new New issues that need assignment. needs triage Planning workflow - pending design/dev review. labels Jan 30, 2023
@github-actions github-actions bot added the ArcGIS Field Apps Issues logged by ArcGIS Field Apps team members. label Jan 30, 2023
@brittneytewks brittneytewks added p - low Issue is non core or affecting less that 10% of people using the library estimate - 3 A day or two of work, likely requires updates to tests. labels Apr 11, 2023
@brittneytewks brittneytewks added this to the 2023 August Priorities milestone Apr 11, 2023
@brittneytewks brittneytewks removed the needs triage Planning workflow - pending design/dev review. label Apr 11, 2023
@geospatialem geospatialem added 1 - assigned Issues that are assigned to a sprint and a team member. and removed 0 - new New issues that need assignment. labels Aug 22, 2023
@driskull driskull assigned jcfranco and driskull and unassigned driskull and jcfranco Aug 23, 2023
@driskull driskull added 2 - in development Issues that are actively being worked on. and removed 1 - assigned Issues that are assigned to a sprint and a team member. labels Aug 24, 2023
driskull added a commit that referenced this issue Aug 25, 2023
**Related Issue:** #6381

## Summary

- catch error when beforeClose promise is rejected
@driskull driskull added 3 - installed Issues that have been merged to master branch and are ready for final confirmation. and removed 2 - in development Issues that are actively being worked on. labels Aug 25, 2023
@github-actions github-actions bot assigned geospatialem and unassigned driskull Aug 25, 2023
@github-actions
Copy link
Contributor

Installed and assigned for verification.

@geospatialem geospatialem added 4 - verified Issues that have been released and confirmed resolved. and removed 3 - installed Issues that have been merged to master branch and are ready for final confirmation. labels Aug 27, 2023
@geospatialem
Copy link
Member

Verified in 1.7.0-next.9

Elijbet pushed a commit that referenced this issue Aug 30, 2023
**Related Issue:** #6381

## Summary

- catch error when beforeClose promise is rejected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - verified Issues that have been released and confirmed resolved. ArcGIS Field Apps Issues logged by ArcGIS Field Apps team members. bug Bug reports for broken functionality. Issues should include a reproduction of the bug. estimate - 3 A day or two of work, likely requires updates to tests. p - low Issue is non core or affecting less that 10% of people using the library
Projects
None yet
Development

No branches or pull requests

7 participants