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] Uncaught TypeError: Cannot read property '_topLevelWrapper' of undefined #1339

Closed
andycall opened this issue Sep 6, 2019 · 1 comment
Assignees
Labels

Comments

@andycall
Copy link
Collaborator

andycall commented Sep 6, 2019

  1. How would you tag this issue?
  • Bug
  1. Describe your issue:
    image

After clicking the push button, the page will throw the above error and the page will freeze.

This error will throw when React Developer Tools is enabled. It seems that there are some problems between rax and React Developer Tools.

version: Rax v1.0.6

Example Code:

import { createElement, useState } from 'rax';
import View from 'rax-view';

function Item(props) {
  const [bool, setState] = useState(false);

  let prop;

  if (bool) {
    prop = {
      style: {
        color: 'red'
      }
    }
  } else {
    prop = {};
  }

  return <button {...prop} onClick={() => setState(!bool)}>{props.index}</button>
}

export default function Home() {
  let [list, setList] = useState([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);

  return (
    <View style={styles.home}>
      <button onClick={() => {
        list = list.concat([0]);
        setList(list);
      }}>push</button>

      {list.map((_, index) => {
        return <Item key={index} index={index} />
      })}
    </View>
  );
}
@andycall andycall added the Bug label Sep 7, 2019
@andycall andycall self-assigned this Sep 25, 2019
@andycall andycall changed the title Uncaught TypeError: Cannot read property '_topLevelWrapper' of undefined [DevTools] Uncaught TypeError: Cannot read property '_topLevelWrapper' of undefined Sep 25, 2019
@wssgcg1213
Copy link
Collaborator

合并到 #1273@andycall

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants