-
Notifications
You must be signed in to change notification settings - Fork 756
replace nulls in props from Rails with undefined #1273
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
replace nulls in props from Rails with undefined #1273
Conversation
First, there are no tests for this. However, we don't want to change the code. See my comment in #1272 Let's convert this to a doc PR. I suggest we add a |
@justin808 |
@MaySoMusician We now have an app for integration tests. Can you please add tests to https://github.com/reactjs/react-rails/tree/master/test/dummy for your feature and I will merge. Be sure to provide a changelog and readme update. Thank you for your contribution! |
@MaySoMusician can you please add tests. |
@justin808 Sure! I will do that. |
@ahangarha Let's get this merged once there are tests. @MaySoMusician Thanks! |
@justin808 I'll be dealing with this today. Thanks for waiting for me! |
45dc85e
to
b631207
Compare
b631207
to
f2ae2e2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend naming react_ujs/src/options.js
as optionsHelpers.js
because it contains only helper functions. The current name options.js
suggests having a file with some class or object related to various options.
@MaySoMusician Any update? |
@MaySoMusician Do you want to finish this one? |
@justin808 @MaySoMusician I will take the lead so we can go for RC. |
Sorry for my long inactivity. I have encountered so large changes in my employment relationship in recent weeks that I was unable to tackle this. I can have a time to start this tonight, that will take some time since I have to build a vm to install Python2 required by the test environments, which is not installed in recent laptops. @ahangarha @justin808 |
@MaySoMusician Happy to hear from your side. I think we can wait for a day or two. Looking forward to the update. |
We're about to release v3... |
@MaySoMusician I rebased your changes on the master branch. |
@MaySoMusician Back to this PR? |
@ahangarha Probably, yes. |
Summary
closes: discussion #1272
I'm currently working a Rails+React project and eliminating
null
s from the type definitions in the frontend as possible, since my team members and I have been bothered about differentiation betweennull
andundefined
in terms of typing.This PR adds an opt-in option to make react_ujs replace all
null
s in the props from Rails withundefined
s, alongside the option system to allow to selectively enable each option. I've made the option default tofalse
so that all existing projects won't break.Read the discussion for the more detailed background.
Other Information
As soon as this gets merged, I'll also update @types/react_ujs to add type definitions of
setOptions(option)
Pull Request checklist