Skip to content

tree does not render nodes #479

Open
@mulib

Description

@mulib

hello, im using the basic example on my Nextjs project
only thing i added is NoSsr component to prevent server side rendering (otherwise it fails)

import React from "react";
import Typography from "@material-ui/core/Typography";
import NoSsr from '@material-ui/core/NoSsr';
import SortableTree from 'react-sortable-tree';

export default class MapComponent extends React.Component {
  constructor(props) {
    super(props);

    this.state = {
      treeData: [{ id: '1', title: 'Chicken', children: [{ id: '1.1', title: 'Egg' }] }],
    };
  }

  render() {
    return (
      <div style={{ height: 400 }}>
        <Typography variant="caption">
          <NoSsr>
            <SortableTree
              treeData={this.state.treeData}
              onChange={treeData => this.setState({ treeData })}
              getNodeKey={({ node }) => node.id} />
          </NoSsr>
        </Typography>
      </div>
    );
  }
}

in browser, i can see that it renders:

  • DragDropContext
    --- ReactSortableTree
    ---- Scrolling
    ----- List
    ------ Grid

it pass the treeDada props all the way down but the tree nodes doesn't getting rendered
any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions