Closed Bug 1811485 Opened 1 year ago Closed 1 year ago

CustomFormatter throws because of "Invalid hook call"

Categories

(DevTools :: Shared Components, defect, P3)

defect

Tracking

(firefox111 fixed)

RESOLVED FIXED
111 Branch
Tracking Status
firefox111 --- fixed

People

(Reporter: nchevobbe, Assigned: nchevobbe)

Details

Attachments

(1 file)

When expanding some custom formatted CLJS objects, I was seeing some "Invalid object" rendered in some ObjectInspector properties, as well as errors in the console about invalid hook.

It turns out it's not possible to use hook in nested components, and since we may have a component tree like

<CustomFormatter>
  <ObjectInspector>
    <ObjectInspectorItem>
      <!-- nested CustomFormatter -->
      <CustomFormatter>
      </CustomFormatter>
    </ObjectInspectorItem>
  <ObjectInspector>
</CustomFormatter>

we can't use hooks
Luckily, it seems easy enough to switch from a function to a component class so we can have proper state.

Assignee: nobody → nchevobbe
Severity: -- → S3
Attachment #9313260 - Attachment description: Bug 1811485 - [devtools] Make `CustomFormatter` a class component. r=sebo. → Bug 1811485 - [devtools] Make `CustomFormatter` a class component. r=bomsy.
Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/497142089d69
[devtools] Make `CustomFormatter` a class component. r=bomsy.
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 111 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: