-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add renderNullWhileWaiting option #400
Conversation
Will review and merge tomorrow - and update the documentation for the new options. Thank you for taking the time to provide the PR. |
By the way, eslint is complaining about unused state in https://github.com/i18next/react-i18next/pull/400/files#diff-686338533c52a0b5b74b17d3c0e73e9dR104 - any reason it is there? |
hm...we used to pass that down to the component as prop to trigger rerender -> seems not to be needed anylonger as we changed to use render props...but will need to double check |
Nice, I actually have the exact same problem at the moment. I think the So can we pass it through without a special |
@tkvw means we could simplify and to include that in every case. As ready is already set to true on constructing https://github.com/i18next/react-i18next/blob/master/src/I18n.js#L33 i think this should be save. @perrin4869 what do you think - so we always pass down ready...just avoid returning null in case that renderNullWhileWaiting is set to false. |
@jamuhl : Thanks for pointing out https://github.com/i18next/react-i18next/blob/master/src/I18n.js#L33 , I now make sure languages and the resourcebundles of the default locale are setup correctly so |
OK I will change it so the ready flag is passed regardless of |
That would make the |
@perrin4869 no. if both |
Hm... aren't |
wait: true , ready: false, renderNullWhileWaiting: true -> returns null |
honestly we can remove renderNullWhileWaiting ;) just set wait: false and check for ready prop |
i think that is even the best solution -> you do not want to wait but you get that ready false to react on |
Done! Things should be in order now :) |
will check this tomorrow and merge, publish and update docs where needed |
published in [email protected] will update docs in a few minutes / hours (rather busy right now with other stuff) |
Thanks to all involved making this happen. |
Thanks for maintaining this as well as always @jamuhl :) |
Hi guys, is there an option to disable this behavior? After updating I need to update all translated components which are using |
@ChristiaanScheermeijer can you make a sample - just not get the problem by current description - as i'm aware of there should be no breaking change |
Hey @jamuhl, sure! I have multiple components which are using this pattern:
Since now the Button component is receiving an unknown tReady prop, I get the following warning:
|
@ChristiaanScheermeijer i see...i guess there is not much we can do...you will have to change your code i guess -> i would suggest as best practice never pass down ...rest to DOM elements -> use something like https://lodash.com/docs/4.17.10#pick |
Ok, I will use this workaround for now:
The
Thanks for looking into this! |
Only would need to document the new option - if
waiting
is set to true, and we are not renderingnull
, we pass aready
flag to the children ofI18next
. If we're using the HoC, then in order to prevent naming clashes, renameready
astReady
and pass it as a prop to theWrappedComponent