Skip to content

fixed insert many require react when the file has many require_tree #398

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

Merged
merged 1 commit into from
Nov 25, 2015

Conversation

towonzhou
Copy link
Contributor

done

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at [email protected]. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@towonzhou
Copy link
Contributor Author

Does not need this?

@rmosolgo
Copy link
Member

Since this doesn't have a test case, I want to read up inject_into_file before I merge it.

If you'd like to help me, you could add a test case which demonstrates the new behavior!

@rmosolgo
Copy link
Member

I tried this out locally:

  • First, I made an application.js which included only:

    //= require_tree ./application 
    //= require_tree ./something_else
    
  • Using react-rails 1.2.0, I ran bundle exec rails g react:install.

  • I observed the unwanted behavior. It added the react stuff to application.js twice:

    //= require react
    //= require react_ujs
    //= require components
    //= require_tree ./application
    //= require react
    //= require react_ujs
    //= require components
    //= require_tree ./something_else
    
  • I reverted application.js to its original state.

  • I pointed at this branch and bundle installed

    Using react-rails 1.4.1 (was 1.2.0) from git://github.com/towonzhou/react-rails.git (at master)
    
  • I ran bundle exec rails g react:install

  • I got the desired behavior. application.js contained:

    //= require react
    //= require react_ujs
    //= require components
    //= require_tree ./application
    //= require_tree ./something_else
    

@rmosolgo
Copy link
Member

🎊 thank you for this fix!

rmosolgo pushed a commit that referenced this pull request Nov 25, 2015
fixed insert many require react when the file has many require_tree
@rmosolgo rmosolgo merged commit 4c85857 into reactjs:master Nov 25, 2015
@towonzhou
Copy link
Contributor Author

@rmosolgo it's my pleasure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants