material-table icon indicating copy to clipboard operation
material-table copied to clipboard

Warning: Failed prop type: Invalid prop `detailPanel` supplied to `MaterialTable`

Open theofournier opened this issue 7 years ago • 17 comments

Hi, First thanks for your awesome package.

I have this error when I put an array of detailPanel as props to the MaterialTable component. image

Here my code : image

But all is working well. There is just this warning in the console. image

Do you know what is the problem?

Thanks

theofournier avatar Apr 01 '19 03:04 theofournier

Hi @theofournier ,

I guess that it is a PropTypes warning. I will take a look at it asap.

mbrn avatar Apr 01 '19 05:04 mbrn

This is done with version 1.31.0

mbrn avatar Apr 11 '19 13:04 mbrn

The warning is still there in version 1.40.1

lasimonne avatar Jul 01 '19 13:07 lasimonne

Hi @lasimonne ,

I will check it asap.

mbrn avatar Jul 01 '19 13:07 mbrn

Hi, i tried in 1.47.0 it works. Thanks

ekaradev avatar Aug 08 '19 13:08 ekaradev

The warning is still there in version 1.50.0

nmwangxin avatar Aug 27 '19 19:08 nmwangxin

Still happening in version 1.54.1

hugoxhaal avatar Nov 22 '19 15:11 hugoxhaal

Happening for me. I think it started after the last update that fixed color props.

backend.js:6 Warning: Failed prop type: Invalid prop `detailPanel` supplied to `MaterialTable`.
in MaterialTable
in Unknown (created by WithStyles(Component))
in WithStyles(Component) (created by ClientList)
in div (created by ClientList)
in ClientList (created by ConnectFunction)

Also, after this new update it started giving me more warning messages:

backend.js:6 Warning: Failed prop type: Invalid prop `color` of value `inherit` supplied to 
`ForwardRef(TextField)`, expected one of ["primary","secondary"].
in ForwardRef(TextField) (created by WithStyles(ForwardRef(TextField)))
in WithStyles(ForwardRef(TextField)) (created by MTableToolbar)
in div (created by ForwardRef(Toolbar))
in ForwardRef(Toolbar) (created by WithStyles(ForwardRef(Toolbar)))
in WithStyles(ForwardRef(Toolbar)) (created by MTableToolbar)
in MTableToolbar (created by WithStyles(MTableToolbar))
in WithStyles(MTableToolbar) (created by Toolbar)
in div (created by Toolbar)
in Toolbar (created by MaterialTable)
in div (created by ForwardRef(Paper))
in ForwardRef(Paper) (created by WithStyles(ForwardRef(Paper)))
in WithStyles(ForwardRef(Paper)) (created by Container)
in Container (created by MaterialTable)
in Provider (created by App)
in App (created by ErrorBoundary)
in ErrorBoundary (created by DragDropContext)
in DragDropContext (created by MaterialTable)
in MaterialTable
in Unknown (created by WithStyles(Component))
in WithStyles(Component) (created by ClientList)
in div (created by ClientList)

And: Warning: Failed prop type: Invalid prop color of value inherit supplied to ForwardRef(FormControl), expected one of ["primary","secondary"]. in ForwardRef(FormControl) (created by WithStyles(ForwardRef(FormControl))) in WithStyles(ForwardRef(FormControl)) (created by ForwardRef(TextField)) in ForwardRef(TextField) (created by WithStyles(ForwardRef(TextField))) in WithStyles(ForwardRef(TextField)) (created by MTableToolbar) in div (created by ForwardRef(Toolbar)) in ForwardRef(Toolbar) (created by WithStyles(ForwardRef(Toolbar))) in WithStyles(ForwardRef(Toolbar)) (created by MTableToolbar) in MTableToolbar (created by WithStyles(MTableToolbar)) in WithStyles(MTableToolbar) (created by Toolbar) in div (created by Toolbar) in Toolbar (created by MaterialTable) in div (created by ForwardRef(Paper)) in ForwardRef(Paper) (created by WithStyles(ForwardRef(Paper))) in WithStyles(ForwardRef(Paper)) (created by Container) in Container (created by MaterialTable) in Provider (created by App) in App (created by ErrorBoundary) in ErrorBoundary (created by DragDropContext) in DragDropContext (created by MaterialTable) in MaterialTable in Unknown (created by WithStyles(Component)) in WithStyles(Component) (created by ClientList) in div (created by ClientList)

lfsando avatar Nov 22 '19 19:11 lfsando

Getting this as well, any help would be appreciated!

connectAdvanced.js:233 Warning: Failed prop type: Invalid prop color of value inherit supplied to ForwardRef(TextField), expected one of ["primary","secondary"]. in ForwardRef(TextField) (created by WithStyles(ForwardRef(TextField))) in WithStyles(ForwardRef(TextField)) (created by MTableToolbar) in div (created by ForwardRef(Toolbar)) in ForwardRef(Toolbar) (created by WithStyles(ForwardRef(Toolbar))) in WithStyles(ForwardRef(Toolbar)) (created by MTableToolbar) in MTableToolbar (created by WithStyles(MTableToolbar)) in WithStyles(MTableToolbar) (created by MaterialTable) in div (created by ForwardRef(Paper)) in ForwardRef(Paper) (created by WithStyles(ForwardRef(Paper))) in WithStyles(ForwardRef(Paper)) (created by Container) in Container (created by MaterialTable) in Provider (created by App) in App (created by ErrorBoundary) in ErrorBoundary (created by DragDropContext) in DragDropContext (created by MaterialTable) in MaterialTable in Unknown (created by WithStyles(Component)) in WithStyles(Component) (created by Students) in Students (created by App) in RouterPage (created by App) in div (created by FocusHandlerImpl) in FocusHandlerImpl (created by Context.Consumer) in FocusHandler (created by RouterImpl) in RouterImpl (created by LocationProvider) in LocationProvider (created by Context.Consumer) in Location (created by Context.Consumer) in Router (created by App) in div (created by App) in App

ahaq0 avatar Dec 11 '19 05:12 ahaq0

The warning still occurs in 1.54.2.

cox-michael avatar Dec 18 '19 18:12 cox-michael

Warning occurs in [email protected]

msidlo avatar Jan 29 '20 16:01 msidlo

I found a solution for this warning in my case, maybe the source of your warning its not the same

Since the warning is throwed by some object validation i started to removing items hoping the warning goes away to find the issue, and realize that when i removed the icon prop, the warning was gone, so i took a look in the docs again and saw the problem:

I was declaring the icon prop in the wrong way: wrong

Right way: right

brunojkurt avatar Jan 31 '20 12:01 brunojkurt

@brunojkurt, While your solution fixes it and I'm using it because I don't want the annoying warning, the documentation says you should be able to do it either way:

detailPanel

Field Type Default Description
disabled boolean false Flag for button disabled or enabled
icon string or ReactElement   Icon of button from material icons or custom component

cox-michael avatar Feb 03 '20 20:02 cox-michael

@ldsmike88 I agree, it should support material icons and other custom elements according the docs.

brunojkurt avatar Feb 04 '20 17:02 brunojkurt

Another solution, create a function in same file that return the icon component

dannielarriola avatar Feb 23 '20 04:02 dannielarriola

Another solution, create a function in same file that return the icon component

@dannielarriola can you give an example? I tried this but it still shows the same error.

"material-table": "^1.57.2",

function getIcon() {
    return VerticalSplitTwoTone;
}
...
detailPanel={[
                    { icon: getIcon(),
...

JimiSweden avatar Mar 02 '20 14:03 JimiSweden

I just did this icon: ()=> <ChatIcon/>, Then all was fixed.

thomskint avatar Mar 10 '20 09:03 thomskint