Closed Bug 1414554 Opened 2 years ago Closed 2 years ago

React 16 listeners not reported in inspector

Categories

(DevTools :: Inspector, enhancement, P2)

enhancement

Tracking

(firefox59 fixed)

RESOLVED FIXED
Firefox 59
Tracking Status
firefox59 --- fixed

People

(Reporter: adrian17, Assigned: adrian17)

Details

Attachments

(1 file)

Example: on https://reactjs.org/ in the third ("todo") example, you can't see the elements' React listeners in the Inspector.

This is because the current code (working in React 15) looks for listeners in the following subobject:

http://searchfox.org/mozilla-central/rev/af86a58b157fbed26b0e86fcd81f1b421e80e60a/devtools/server/event-parsers.js#274

node.__reactInternalInstance$1234._currentElement.props

While in React 16 I can see the listeners are stored in the following subobjects:

node.__reactInternalInstance$1234.memoizedProps
and (it seems to have the same content, at least on React homepage example)
node.reactEventHandlers$1234
Thanks for filing. I see you've already investigated the issue, would you be interested in providing a fix for it? I can help find a mentor for you if that helps!
Severity: normal → enhancement
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(adrian.wielgosik)
Priority: -- → P2
The reason I didn't do so is because I don't really know or use React (I only did minor unrelated work in projects using it, which is when I accidentally found the bug), so I don't feel confident I'm able to test it thoroughly or write new unit tests using React. The above analysis was based on a quick look in devtools and I think it'd be better if someone with more React experience verified and implemented this.
Flags: needinfo?(adrian.wielgosik)
I gave it a shot.
Comment on attachment 8940543 [details]
Bug 1414554 - handle React 16 event listeners.

https://reviewboard.mozilla.org/r/210746/#review216568

r+ assuming green try
Attachment #8940543 - Flags: review?(mratcliffe) → review+
Just realized I left some testing lines in two .html files:

    class CC{
      f(){}
    }

Should I update the review, or can they be stripped on push?
Assignee: nobody → adrian.wielgosik
Has Regression Range: --- → irrelevant
Has STR: --- → yes
OS: Unspecified → All
Hardware: Unspecified → All
Pushed by mratcliffe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7dbb3bae3a99
handle React 16 event listeners. r=miker
https://hg.mozilla.org/mozilla-central/rev/7dbb3bae3a99
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 59
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.