Skip to content
This repository was archived by the owner on Nov 9, 2024. It is now read-only.

Conversation

@CPatchane
Copy link
Contributor

👋

Those props are added by babel-preset-react in dev environment (by @babel/plugin-transform-react-jsx-self and @babel/plugin-transform-react-jsx-source)
Documentation: https://babeljs.io/docs/en/babel-preset-react/

But they are passed directly to tippy and currently we have the warnings everywhere I am using it in my development environment:
Screenshot 2019-10-21 at 18 30 14

@atomiks
Copy link
Owner

atomiks commented Oct 22, 2019

Can't you create a wrapper component that filters these out? I think this issue came up a while ago and that solved it.

i.e.

export default forwardRef(({__source, __self, ...props}, ref) => {
  return <Tippy {...props} ref={ref} />;
});

@CPatchane
Copy link
Contributor Author

I just tried it seems to not working in my code, I still have warnings :/

Is it the wrong place to remove it here? Since this is a dedicated React wrapper for Tippy, this could be the good place to handle it or I am wrong?

@atomiks
Copy link
Owner

atomiks commented Oct 22, 2019

Well the problem is how many other rogue props need to be handled? Not just from those plugins. If it works for the user to create a wrapper to handle their problem case then that would be better.

If these are the most common plugins though, then I guess it would be okay unless there are any more of them. (Maybe move the delete to destructured arguments?)

@CPatchane
Copy link
Contributor Author

I see your point, if it can help I found that in the React source code https://github.com/facebook/react/blob/d3622d0f977def825123f1d5f4cef19888b1eaf1/packages/react/src/ReactElement.js#L16

For me those props seems to be an implementation detail so we should not be aware how to handle it using Tippy (I am curious that I don't find any other issues about that btw).

@CPatchane
Copy link
Contributor Author

@atomiks Do you prefer to use the destructured arguments to remove them? You won't have any linting errors about unused variables?

@atomiks
Copy link
Owner

atomiks commented Oct 24, 2019

Do you prefer to use the destructured arguments to remove them?

I think so, the linter doesn't seem to complain for me

config has this 'no-unused-vars': ['error', {ignoreRestSiblings: true}],

Those props are added by babel-preset-react in dev environment
@CPatchane CPatchane force-pushed the fix/filter_react_dev_props branch from 4871f55 to 585d59f Compare October 24, 2019 08:55
@CPatchane
Copy link
Contributor Author

@atomiks It's done ;)

@atomiks
Copy link
Owner

atomiks commented Oct 24, 2019

Thank you!

@atomiks atomiks merged commit dae45dd into atomiks:master Oct 24, 2019
@CPatchane CPatchane deleted the fix/filter_react_dev_props branch October 25, 2019 08:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants