Skip to content

Fix cancelled HTTP requests showing as Pending in DevTools Network tab#9685

Open
rishika0212 wants to merge 1 commit intoflutter:masterfrom
rishika0212:fix-network-cancelled-status
Open

Fix cancelled HTTP requests showing as Pending in DevTools Network tab#9685
rishika0212 wants to merge 1 commit intoflutter:masterfrom
rishika0212:fix-network-cancelled-status

Conversation

@rishika0212
Copy link
Contributor

Description

This PR fixes an issue where cancelled HTTP requests appear as "Pending" in the DevTools Network tab.

When a request is aborted (for example using HttpClientRequest.abort or Dio cancellation), DevTools keeps the request in a Pending state because no response is received. This change detects such cases and displays the request status as "Cancelled" instead.

Changes

  • Detect cancelled/aborted requests in HttpRequestData
  • Display "Cancelled" instead of "Pending" in the Network table
  • Ensure cancelled requests are no longer treated as inProgress
  • Prevent duration from remaining null for cancelled requests
  • Add a regression test to verify the behavior
  • Update CustomPointerScrollView to use cacheExtent so the project compiles with the current Flutter SDK

All existing network tests pass locally.

Fixes: #9593

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read the Flutter Style Guide recently and followed its advice.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I added tests to check the change I am making.

build.yaml badge

If you need help, consider asking for help on Discord.

@rishika0212 rishika0212 requested review from a team, bkonyi and kenzieschmoll as code owners March 5, 2026 16:38
Copy link
Contributor

@srawlins srawlins left a comment

Choose a reason for hiding this comment

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

This code looks great; thanks for the PR! I'd like to test manually before landing.

super.shrinkWrap,
super.padding,
super.scrollCacheExtent,
super.cacheExtent,
Copy link
Contributor

Choose a reason for hiding this comment

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

CC @elliette ; from the PR description:

Update CustomPointerScrollView to use cacheExtent so the project compiles with the current Flutter SDK

Copy link
Contributor

@bkonyi bkonyi left a comment

Choose a reason for hiding this comment

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

LGTM overall!

return false;
}

return _hasError
Copy link
Contributor

Choose a reason for hiding this comment

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

Ubernit: We can simply negate the entire expression rather than doing it twice

return !(_hasError
           ? _request.isRequestComplete
           : _request.isResponseComplete);

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.

Cancelled requests are shown as "Pending" in Devtools Network Tab

3 participants