Skip to content

fix: keep network search field enabled after clearing calls#9855

Open
ishaquehassan wants to merge 3 commits into
flutter:masterfrom
ishaquehassan:fix/9853-enable-search-after-clear
Open

fix: keep network search field enabled after clearing calls#9855
ishaquehassan wants to merge 3 commits into
flutter:masterfrom
ishaquehassan:fix/9853-enable-search-after-clear

Conversation

@ishaquehassan

Copy link
Copy Markdown

Fixes #9853.

The Network tab search field was tied to whether any requests were currently present. _NetworkProfilerControlsState.build computed hasRequests from controller.filteredData and passed it to SearchField as searchFieldEnabled, so the moment all calls were cleared the field went disabled and the query could no longer be edited.

This drops the hasRequests gate. SearchField.searchFieldEnabled already defaults to true, so removing the argument keeps the field enabled at all times. That matches how search fields behave elsewhere in DevTools and lets users prepare or adjust a query before the next batch of requests arrives, without needing live traffic first.

Tests

Added search field stays enabled after clearing to network_profiler_test.dart, inside the existing Network Profiler group. It loads the screen with requests, confirms the search field TextField is enabled, pauses recording, taps the Clear button so controller.requests is emptied, then asserts the TextField is still enabled. Before this change the field was gated on hasRequests, so it would be disabled in that state and the assertion would fail.

dart analyze and dart format are clean on both changed files. Running the widget test against my locally installed Flutter SDK currently fails to compile because of an unrelated, pre-existing framework error (isSizedToContent getter missing on WindowingOwnerLinux in flutter/lib/src/widgets/_window_linux.dart), which reproduces without this change. CI compiles against the pinned SDK.

Pre-launch Checklist

General 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 have followed its advice.
  • I signed the CLA.
  • I updated/added relevant documentation (doc comments with ///).

Issues checklist

Tests checklist

  • I added new tests to check the change I am making...
  • OR there is a reason for not adding tests, which I explained in the PR description.

AI-tooling checklist

  • I did not use any AI tooling in creating this PR.
  • OR I did use AI tooling, and...
    • I read the AI contributions guidelines and agree to follow them.
    • I reviewed all AI-generated code before opening this PR.
    • I understand and am able to discuss the code in this PR.
    • I have verifed the accuracy of any AI-generated text included in the PR description.
    • I commit to verifying the accuracy of any AI-generated code or text that I upload in response to review comments.

Feature-change checklist

  • This PR does not change the DevTools UI or behavior and...
    • I added the release-notes-not-required label or left a comment requesting the label be added.
  • OR this PR does change the DevTools UI or behavior and...
    • I added an entry to packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md.
    • I included before/after screenshots and/or a GIF demo of the new UI to my PR description.
    • I ran the DevTools app locally to manually verify my changes.

build.yaml badge

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

The Network screen search field was gated on whether any requests were present, so clearing all calls left the field disabled and the query could no longer be edited. Drop the hasRequests gate so the field stays enabled at all times, matching the default search field behavior used elsewhere in DevTools.

Fixes flutter#9853
@ishaquehassan ishaquehassan requested a review from a team as a code owner June 15, 2026 07:56

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request ensures that the network search field remains enabled even when there are no active requests, allowing users to modify their search query in advance. A corresponding widget test has been added to verify this behavior. The reviewer noted that because controller.filteredData is no longer used in the build method, the listener on it in initState is now redundant and should be removed to avoid unnecessary rebuilds.

Comment thread packages/devtools_app/lib/src/screens/network/network_screen.dart
The network search field is now always enabled and no longer reads
controller.filteredData in build, so this listener only forced needless
rebuilds of the controls row on every filter change.
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.

Network tab search box should remain enabled and editable after clearing calls

1 participant