Calling `ReactDOMServer.renderToStaticMarkup(elementWithPortal);` gets stuck in a loop while trying to do a static render.

Current behavior:
The behavior can be seen here: https://codepen.io/anon/pen/BmqWOM  by un-commenting line 58 (warning: this will make your tab freeze)

Expected behavior:
It should return with results or throw some kind of error if the input is not valid

ReactDOM.unmountComponentAtNode(element);
      expect(element.innerHTML).toEqual('');
      
      
      element.innerHTML = lastMarkup;
      instance = ReactDOM.render(<TestComponent name="y" />, element);
      expect(mountCount).toEqual(4);
      if (__DEV__) {
        expect(console.error.calls.count()).toBe(1);
        expect(console.error.calls.argsFor(0)[0]).toContain(
          'Text content did not match. Server: "x" Client: "y"',
        );
        console.error.calls.reset();
      }
      expect(element.innerHTML.length > 0).toBe(true);
      expect(element.innerHTML).not.toEqual(lastMarkup);
      
      expect(numClicks).toEqual(1);
      ReactTestUtils.Simulate.click(ReactDOM.findDOMNode(instance.refs.span));
      expect(numClicks).toEqual(2);
      if (__DEV__) {
        expect(console.warn.calls.count()).toBe(0);
        expect(console.error.calls.count()).toBe(0);
      }
    });
    it('should have the correct mounting behavior (new hydrate API)', () => {
      spyOnDev(console, 'error');
      var mountCount = 0;
      var numClicks = 0;
      class TestComponent extends React.Component {