Closed Bug 1731770 Opened 8 months ago Closed 6 months ago

Filtering JSON properties in the Response panel collapse any expanded node

Categories

(DevTools :: Netmonitor, defect, P3)

defect

Tracking

(firefox96 fixed)

RESOLVED FIXED
96 Branch
Tracking Status
firefox96 --- fixed

People

(Reporter: nchevobbe, Assigned: claubatista)

References

(Blocks 1 open bug)

Details

(Whiteboard: dt-outreachy-2021)

Attachments

(1 file)

Steps to reproduce

  1. Go to https://jsonplaceholder.typicode.com/
  2. Open the netmonitor
  3. Hit <kbd>Esc</kbd> to show the split console
  4. In the console, evaluate fetch('https://jsonplaceholder.typicode.com/todos')
  5. Select the matching request in the netmonitor, and select the Response panel
  6. Expand the first item in the JSON object
  7. In the Filter properties search input, type title

Expected results

The node that was expanded is still expanded, and we're only displaying the title property

Actual results

The node was collapsed, so I need to expand it again


Thank you for the report, Nicolas.

A few comments.

The TreeView (used to render parsed JSON response preview) doesn't persist its state across re-renderings. I.e. the current expanded/collapsed state is lost when the tree is re-rendered. You can also see it when switching to another side panel and back to the Response panel.

The good news is that the TreeView has internal support for storing the list of expanded nodes.

  • Use TreeViewClass.getExpandedNodes to get list of expanded nodes in a tree object
  • Set property expandedNodes when rendering a tree

See this code in PropertiesView (which is also used to render the JSON response preview)
https://searchfox.org/mozilla-central/rev/50c3cf7a3c931409b54efa009795b69c19383541/devtools/client/netmonitor/src/components/request-details/PropertiesView.js#212-217

if the expandedNodes prop was specified the tree would initialize its state properly.

It looks like the Properties view should store the list of expanded nodes at the beginning, update the list every time a node is expanded or collapsed and use the list every time it's rendered. Or something along these lines.
Could be good second bug, perhaps.

Check if this can be good first bug or outreachy

Severity: -- → S3
Flags: needinfo?(hmanilla)
Priority: -- → P3
Assignee: nobody → contatodaclau
Flags: needinfo?(hmanilla)
Whiteboard: dt-outreachy-2021
Pushed by hmanilla@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1f2fde2975bb
[devtools] Persit expanded nodes state in the Response Panel. r=bomsy
Flags: needinfo?(contatodaclau)

There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:claubatista, could you have a look please?
For more information, please visit auto_nag documentation.

Flags: needinfo?(hmanilla)
Flags: needinfo?(contatodaclau)
Pushed by hmanilla@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/987c3ed5e2b9
[devtools] Persit expanded nodes state in the Response Panel. r=bomsy
Flags: needinfo?(contatodaclau)
Status: NEW → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 96 Branch
Flags: qe-verify+
Flags: qe-verify+
QA Whiteboard: [qa-96b-p2]
Flags: needinfo?(hmanilla)
You need to log in before you can comment on or make changes to this bug.