Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DevTools crash when inspecting document.all #19619

Merged
merged 8 commits into from
Aug 21, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/react-devtools-shared/src/hydration.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ export function dehydrate(
),
);

case 'html_all_collection':
case 'typed_array':
case 'iterator':
isPathAllowedCheck = isPathAllowed(path);
Expand Down
5 changes: 5 additions & 0 deletions packages/react-devtools-shared/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ export type DataType =
| 'data_view'
| 'date'
| 'function'
| 'html_all_collection'
| 'html_element'
| 'infinity'
| 'iterator'
Expand Down Expand Up @@ -405,6 +406,10 @@ export function getDataType(data: Object): DataType {
return 'html_element';
}

if (Object.prototype.toString.call(data) === '[object HTMLAllCollection]') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we also do the same fix for HTMLElement case above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems more difficult. Indeed it returns HTMLDivElement, HTMLSpanElement... If I have to change it, I have to do an extra treatment.

gaearon marked this conversation as resolved.
Show resolved Hide resolved
return 'html_all_collection';
}

const type = typeof data;
switch (type) {
case 'bigint':
Expand Down