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

[DevTools] Support object destructuring pattern without runtime errors #22128

Merged
merged 1 commit into from
Aug 18, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ export class SourceMapMetadataConsumer {
return getHookNameForLocation({line, column}, hookMap);
}

hasHookMap(source: ?string) {
hasHookMap(source: ?string): boolean {
if (source == null) {
return null;
return false;
}
return this._getHookMapForSource(source) != null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
* @flow
*/

import React, {useEffect, useState} from 'react';
import React, {useDebugValue, useEffect, useState} from 'react';

export function Component() {
const [count, setCount] = useState(0);
const isDarkMode = useIsDarkMode();
const {foo} = useFoo();

useEffect(() => {
// ...
Expand All @@ -23,6 +24,7 @@ export function Component() {
<>
<div>Dark mode? {isDarkMode}</div>
<div>Count: {count}</div>
<div>Foo: {foo}</div>
<button onClick={handleClick}>Update count</button>
</>
);
Expand All @@ -37,3 +39,8 @@ function useIsDarkMode() {

return isDarkMode;
}

function useFoo() {
useDebugValue('foo');
return {foo: true};
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading