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

New handlers for FetchService #3750

Merged
merged 9 commits into from
Aug 14, 2024
Merged

New handlers for FetchService #3750

merged 9 commits into from
Aug 14, 2024

Conversation

lbwexler
Copy link
Member

@lbwexler lbwexler commented Aug 8, 2024

This provides support I need for being able to catch 401s, in non-SSO based scenario, and respond appropriately by bringing up.

The handler for the successful response seemed like a good thing to add at the same time for symmetry, and we have seen a couple of places where it might have been useful, and avoided the need for overriding FetchService to look for e.g. 200 returns with success: false

Hoist P/R Checklist

Pull request authors: Review and check off the below. Items that do not apply can also be
checked off to indicate they have been considered. If unclear if a step is relevant, please leave
unchecked and note in comments.

  • Caught up with develop branch as of last change.
  • Added CHANGELOG entry, or determined not required.
  • [X ] Reviewed for breaking changes, added breaking-change label + CHANGELOG if so.
  • Updated doc comments / prop-types, or determined not required.
  • Reviewed and tested on Mobile, or determined not required.
  • Created Toolbox branch / PR, or determined not required.

If your change is still a WIP, please use the "Create draft pull request" option in the split
button below to indicate it is not ready yet for a final review.

Pull request reviewers: when merging this P/R, please consider using a squash commit to
collapse multiple intermediate commits into a single commit representing the overall feature
change. This helps keep the commit log clean and easy to scan across releases. PRs containing a
single commit should be rebased when possible.

@lbwexler lbwexler requested review from amcclain and ghsolomon August 8, 2024 15:23
CHANGELOG.md Outdated Show resolved Hide resolved
@lbwexler
Copy link
Member Author

@ghsolomon -- thanks again for taking a look, and your comments -- refactoring to try to take account of your comments, I realized that I have a problem with the onResolved side. In particular, for some requests, we will be resolving to a processed any and for others to a FetchResponse

@lbwexler
Copy link
Member Author

ok @ghsolomon -- can you take another look? Simplified this to deal with just the exception case.
Also -- made some orthogonal refactors/cleanups while working through this code that I think we should take.

@ghsolomon
Copy link
Contributor

Looks good to me. One other thought - since we're supporting multiple exception handlers and only allowing developers to append their own, should we move our built-in library handlers out of managedFetchAsync and put them in that array initially? Could be a nice way to demonstrate the pattern and simplify managedFetchAsync a bit.

I.e. private _exceptionHandlers: FetchExceptionHandler[] = [this.TIMEOUT_HANDLER, this.ABORTED_HANDLER, this.SERVER_UNAVAILABLE_HANDLER]

@lbwexler lbwexler marked this pull request as ready for review August 14, 2024 22:13
@lbwexler lbwexler merged commit e6c723f into develop Aug 14, 2024
1 check passed
@lbwexler lbwexler deleted the fetchHandlers branch August 14, 2024 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants