preactjs / preact-compat

ATTENTION: The React compatibility layer for Preact has moved to the main preact repo.
http://npm.im/preact-compat
MIT License
949 stars 148 forks source link

Infinite loop when rendering blueprintjs's tree component #241

Open sceutre opened 7 years ago

sceutre commented 7 years ago

I am using preact with webpack and the following aliases: { 'react': 'preact-compat', 'react-dom': 'preact-compat', 'react-addons-css-transition-group': 'rc-css-transition-group' }

Which seems to work fine.

We are evaluating the new blueprintjs react library (1) and I was attempting to add a tree component. When I use their example code (2) then it works fine in react itself, but goes into an infinte loop when using preact.

(1): http://blueprintjs.com/ (2): https://github.com/palantir/blueprint/blob/master/packages/core/examples/treeExample.tsx

developit commented 7 years ago

Looks like it might be related to props.children bring an empty array. Does this happen outside the demo when not extending a shared class?

sceutre commented 7 years ago

Yes, this more minimal example displays the same behavior:

import * as React from "react";
import {Tree} from "@blueprintjs/core";

export class JSONPreview extends React.Component<{},{}> {
   render() {
      let contents:any = [ { id: 1, label: "A folder" } ];
      return (
         <div>
            {"{"}
            <Tree contents={contents} />
            {"}"}
         </div>
      );
   }
}
developit commented 7 years ago

I think this might be fixed as of preact 7.1?

ruiaraujo commented 7 years ago

I had a similar issue in my application and can confirm that 7.1 can render it for the first time.

developit commented 7 years ago

@ruiaraujo nice! anything else with Blueprint having issues? If not we can close this issue out 🎉

ruiaraujo commented 7 years ago

@developit Just to be clear. I was not using blueprint. I just had an infinite loop that did get resolved with 7.1.

Since I tried every release from 6.x. I have some confident that 7.1 made a difference.

developit commented 7 years ago

Ahh sorry, that makes sense. Here's hoping the issue was similar and they are both fixed :)

sceutre commented 7 years ago

Unfortunately I still see the same behavior with the example code above using preact@7.1.0 and preact-compat@3.9.4

developit commented 7 years ago

Alright, thanks for testing @sceutre!

TomMarius commented 7 years ago

Any update?

developit commented 7 years ago

Nope! There have been a whole bunch of releases since the last comment though, it's very possible this is no longer an issue.

warpdesign commented 5 years ago

Is this still a problem with preact x? I am considering the switch to preact for one of my app.