Skip to content

Commit

Permalink
fix(deprecation): Make Wrapper deprecation warning only show once (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
MilosRasic authored and rkuykendall committed Dec 1, 2017
1 parent 7542dd1 commit a1c0bbe
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,9 +469,14 @@ const addValidationRule = (name, func) => {

const withFormsy = Wrapper;

let didWarnAboutWrapperDeprecation = false;

const deprecatedWrapper = (Component) => {
// eslint-disable-next-line no-console
console.warn('Wrapper has been renamed to withFormsy. Importing Wrapper from formsy-react is depreacted and will be removed in the future. Please rename your Wrapper imports to withFormsy.');
if (!didWarnAboutWrapperDeprecation) {
// eslint-disable-next-line no-console
console.warn('Wrapper has been renamed to withFormsy. Importing Wrapper from formsy-react is depreacted and will be removed in the future. Please rename your Wrapper imports to withFormsy.');
didWarnAboutWrapperDeprecation = true;
}

return withFormsy(Component);
};
Expand Down

0 comments on commit a1c0bbe

Please sign in to comment.