### Website or app

https://github.com/eps1lon/react-devtools-repro-no-matching-node/

### Repro steps

1. `yarn start`
2. Open `App.js`
3. Uncomment the `useEffect` block
4. Click to inspect "Component" in DevTools
5. Error: "_Could not inspect element with id 5_"

Originally reported in https://github.com/facebook/react/issues/21436#issuecomment-835406075

---

https://user-images.githubusercontent.com/12292047/117544707-e6a6cd80-b022-11eb-9f8f-bb8cfd9f7743.mp4

### How often does this bug happen?

Every time

static contextType = BoolContext;
      render() {
        return null;
      }
    }
    const ModernContext = React.createContext();
    ModernContext.displayName = 'ModernContext';
    const container = document.createElement('div');
    await utils.actAsync(() =>
      ReactDOM.render(
        <React.Fragment>
          <LegacyContextProvider>
            <LegacyContextConsumer />
          </LegacyContextProvider>
          <BoolContext.Consumer>{value => null}</BoolContext.Consumer>
          <ModernContextType />
          <ModernContext.Provider value={contextData}>
            <ModernContext.Consumer>{value => null}</ModernContext.Consumer>
          </ModernContext.Provider>
        </React.Fragment>,
        container,
      ),
    );
    const cases = [
      {
        
        index: 1,
        shouldHaveLegacyContext: true,
      },
      {