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

[Bug]: undefined is not an object (evaluating ' request.signal.aborted ') #11907

Open
yxqme opened this issue Aug 20, 2024 · 1 comment
Open
Labels

Comments

@yxqme
Copy link

yxqme commented Aug 20, 2024

What version of React Router are you using?

react-router-dom 6.26.1

Steps to Reproduce

Use lazy loading for the page.

lazy: () => import("./pages"),

In browsers that do not support request.signal For example, iOS phone version 13.6. The following code will throw an error undefined is not an object (evaluating ' request.signal.aborted ')

if (request.signal.aborted) {
    // Handle aborted request
}

Can it be changed to the code below to improve compatibility?

// ... existing code ...
if (request.signal && request.signal.aborted) {
    // Handle aborted request
}
// ... existing code ...

Expected Behavior

Do not throw an error.

Actual Behavior

Threw an error.

@yxqme yxqme added the bug label Aug 20, 2024
@BrianWoolfolk
Copy link

It's there a PR about this? I think request.signal?.aborted would be simpler. Being such a small fix, I could send a PR in a moment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants
@yxqme @BrianWoolfolk and others