Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@mikemurray
Copy link
Member

@mikemurray mikemurray commented Sep 13, 2019

Resolves #5548
Impact: minor
Type: frefactor

Issue

Prop-type warning from ReactSrotableTree

backend.js:1 Warning: Failed prop type: Invalid prop `theme.nodeContentRenderer` of type `object` supplied to `ReactSortableTree`, expected `function`.
    in ReactSortableTree (created by Context.Consumer)
    in SortableTreeWithoutDndContext (created by NavigationTreeContainer)

Solution

Refactor SortableNodeContentRenderer into a function component. This fixes an issue with the ReactSortableTree theme as withStyles from MUI uses React.forwardRef. The propType of components with a forwarded ref is an object rather than a function, which ReactSortableTree expects.

Breaking changes

none.

Testing

  1. Use the navigation tree editor http://localhost:3000/operator/navigation
  2. Ensure the nodes render and you can add an remove nodes as usual to the tree.
  3. Open the console and verify that there are no proptype warnings

Signed-off-by: Mike Murray <[email protected]>
This fixes an issue with the ReactSortableTree theme as `withStyles` from MUI uses `React.forwardRef`. The propType of components with a forwarded ref is an `object` rather than a `function`, which ReactSortableTree expects.

Signed-off-by: Mike Murray <[email protected]>
@mikemurray mikemurray changed the title refactor: 5548 mikemurray react sortable tree theme [WIP] refactor: Fix proptype warning with ReactSortableTree Sep 13, 2019
@mikemurray mikemurray requested a review from willopez September 13, 2019 18:32
@mikemurray mikemurray changed the title [WIP] refactor: Fix proptype warning with ReactSortableTree refactor: Fix proptype warning with ReactSortableTree Sep 13, 2019
Copy link
Member

@willopez willopez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, ignoring the failing integration test as all tests pass locally.

Signed-off-by: Mike Murray <[email protected]>
@mikemurray mikemurray merged commit 0ae494c into develop Sep 13, 2019
@mikemurray mikemurray deleted the refactor-5548-mikemurray-react-sortable-tree-theme branch September 13, 2019 21:33
@kieckhafer kieckhafer mentioned this pull request Sep 18, 2019
@kieckhafer kieckhafer mentioned this pull request Sep 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants