Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display deprecation warnings to the consumer. #175

Open
wants to merge 4 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@smaxa20
Copy link
Contributor

commented Jun 11, 2019

The only deprecated element I could find was text-input v1 which was built using Typeahead and AsyncTypeahead, so I included those two elements. If I'm mistaken on how text-input v1 works or if I missed some deprecated elements let me know.

AsyncTypeahead.propTypes = {
inferred: PropTypes.bool,
};
export class AsyncTypeahead extends React.Component {

This comment has been minimized.

Copy link
@bryanrsmith

bryanrsmith Jun 12, 2019

Collaborator

Instead of converting to the older class API to gain access to the lifecycle method, use a useEffect callback with an empty dependency array.

https://reactjs.org/docs/hooks-effect.html

Something like:

if (process.env.NODE_ENV !== 'production') {
	useEffect(() => {
		console.warn()
	}, []);
}

This comment has been minimized.

Copy link
@smaxa20

smaxa20 Jun 12, 2019

Author Contributor

I tried this and it kept saying that useEffect was undefined. I now realize that I never included it from react, *facepalm*

Scott Maxa
@smaxa20

This comment has been minimized.

Copy link
Contributor Author

commented Jun 12, 2019

While reviewing what @bryanrsmith suggested, I found that the Typeahead and AsyncTypeahead elements were built off of Bootstrap. This means that the warnings I threw from the bootstrap elements are also being thrown for these elements. In my most recent commit 8fe6111 I undid my changes from the first commit in this PR 2d7b6e5. This removes the duplicate warnings that were being thrown. Now the only warnings that are being thrown are from the Bootstrap elements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.