antonioru / beautiful-react-hooks

🔥 A collection of beautiful and (hopefully) useful React hooks to speed-up your components and hooks development 🔥

Home Page:https://antonioru.github.io/beautiful-react-hooks/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove or reduce unsupported API console warnings

marksmccann opened this issue · comments

Is your feature request related to a problem? Please describe.
When we build our application with pre-rendering enabled, we get a host of console warnings about the API being unsupported like this one. Because, this message is called for every instance of the hook, it drastically clutters our console.

Describe the solution you'd like
I certainly understand the value of this message, but it would be great if this feature could be disabled.

Describe alternatives you've considered
Alternatively, a reduction in the number of consoles would be an improvement. For example, you could limit the number of times a particular message is called. This would preserve the purpose and value of the message, but limit the number of consoles and dramatically reduce the clutter.

Additional context
By the way, our team loves this package. Thanks for putting it together!

commented

HI @marksmccann thanks for the feedback
I see your point and I agree it makes sense to disable or limit the console.log messages.

I would prefer to limit each message to one message as first improvement... something like:

const cache = new Map();
 
const warningMessage = (message) => {
  if(!cache.has(message) {
     cache.set(message, true)
     console.log(message)
  }
}

I'll try to make this improvement as soon as possible but feel free to open a PR if you want

commented

hi @marksmccann the last release of this library should solve your problem, please update and let me know if we can close this issue

Looks great, thanks! Feel free to close.