netceteragroup/react-message-source

If translations are not provided for some reason, it results in an crash

spirkovskii opened this issue · 3 comments

If translations are not provided for some reason, it results in an crash.

Since the behavior for a missing entry in the translations is to return the key itself, I think it would be nice to return the key itself also in the case where the whole translations are missing, and log a error.

I will open a pull request when I have time, if this isn't fixed in the meantime 😄

Hi @w1cker, correct 😅

This needs to be fixed in the library itself. I'll be happy to accept a PR with a fix.
In meantime, you can utilize the transform prop to workaround this issue.

<FetchingProvider
  url="https://your.server.com/api/..."
  transform={response => response ?? {}}
>
  {children}
</FetchingProvider>

Hey @oliverlaz, i put up a quick fix for this. I was not sure if the fix i did is what this issue was actually referring to, but please take a look at it when you have some free time.

Hi @AndrejGeorgiev,

Thank you for your contribution. #26 is merged and released in v2.3.1. Please feel free to give it a try :)