preact-compat icon indicating copy to clipboard operation
preact-compat copied to clipboard

Infinite loop when rendering blueprintjs's tree component

Open sceutre opened this issue 9 years ago • 12 comments

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

sceutre avatar Nov 17 '16 17:11 sceutre

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?

developit avatar Nov 17 '16 17:11 developit

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>
      );
   }
}

sceutre avatar Nov 17 '16 17:11 sceutre

I think this might be fixed as of preact 7.1?

developit avatar Dec 06 '16 15:12 developit

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

ruiaraujo avatar Dec 08 '16 17:12 ruiaraujo

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

developit avatar Dec 09 '16 00:12 developit

@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.

ruiaraujo avatar Dec 09 '16 00:12 ruiaraujo

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

developit avatar Dec 09 '16 01:12 developit

Unfortunately I still see the same behavior with the example code above using [email protected] and [email protected]

sceutre avatar Dec 09 '16 04:12 sceutre

Alright, thanks for testing @sceutre!

developit avatar Dec 09 '16 18:12 developit

Any update?

TomMarius avatar Mar 09 '17 17:03 TomMarius

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

developit avatar Mar 09 '17 23:03 developit

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

warpdesign avatar Jun 02 '19 21:06 warpdesign