@samitouri / QOS-React / commits / 52014671bf

Make Flow happy

Dan Abramov committed Apr 8, 2019 at 18:03 UTC 52014671bf42df73fd8764de2c18c979cad47ff8
1 file changed +4 -4
src/devtools/views/Components/Element.js
+4 -4
@@ -86,20 +86,20 @@ export default function ElementView({ index, style, data }: Props) {
86 [id, selectElementByID]
87 );
88
89 - const rendererID = store.getRendererIDForElement(element.id);
89 + const rendererID = id !== null ? store.getRendererIDForElement(id) : null;
90 // Individual elements don't have a corresponding leave handler.
91 // Instead, it's implemented on the tree level.
92 const handleMouseEnter = useCallback(() => {
93 - if (rendererID !== null) {
93 + if (element !== null && id !== null && rendererID !== null) {
94 bridge.send('highlightElementInDOM', {
95 displayName: element.displayName,
96 hideAfterTimeout: false,
97 - id: element.id,
97 + id,
98 rendererID,
99 scrollIntoView: false,
100 });
101 }
102 - }, [bridge, element, rendererID]);
102 + }, [bridge, element, id, rendererID]);
103
104 // Handle elements that are removed from the tree while an async render is in progress.
105 if (element == null) {