All notable changes to this project will be documented in this file. Items under Unreleased
is upcoming features that will be out in next version.
Contributors: please follow the recommendations outlined at keepachangelog.com. Please use the existing headings and styling as a guide, and add a link for the version diff at the bottom of the file. Also, please update the Unreleased
link to compare to the latest release version.
- Cleaned up code in
spec/dummy
to latest React and Redux APIs. See #282. - Update generator messages with helpful information. See #279.
- Other small generated comment fixes and doc fixes.
- Fixed missing information in the helpful message after running the base install generator regarding how to run the node server with hot reloading support.
- Fixed several jscs linter issues.
- Fix Bootstrap Sass Append to Gemfile, missing new line. #262.
- Added helper
redux_store
and associated JavaScript APIs that allow multiple React components to use the same store. Thus, you initialize the store, with props, separately from the components. - Added forman to gemspec in case new dev does not have it globally installed. #248.
- Support for Turbolinks 5! #270.
- Added better error messages for
ReactOnRails.register()
. #273.
-
Calls to
react_component
should use a named argument of props. For example, change this:<%= react_component("ReduxSharedStoreApp", {}, prerender: false, trace: true) %>
to
<%= react_component("ReduxSharedStoreApp", props: {}, prerender: false, trace: true) %>
You'll get a deprecation message to change this.
-
Renamed
ReactOnRails.configure_rspec_to_compile_assets
toReactOnRails::TestHelper.configure_rspec_to_compile_assets
. The code has also been optimized to check for whether or not the compiled webpack bundles are up to date or not and will not run if not necessary. If you are using non-standard directories for your generated webpack assets (app/assets/javascripts/generated
andapp/assets/stylesheets/generated
) or have additional directories you wish the helper to check, you need to update your ReactOnRails configuration accordingly. See documentation for how to do this. #253. -
You have to call
ReactOnRails.register
to register react components. This was deprecated in v2. #273.
- spec/dummy/spec/rails_helper.rb for an example. Add this line to your
rails_helper.rb
:
RSpec.configure do |config|
# Ensure that if we are running js tests, we are using latest webpack assets
ReactOnRails::TestHelper.configure_rspec_to_compile_assets(config)
- Change view helper calls to react_component to use the named param of
props
. See forum post Using Regexp to update to ReactOnRails v3.
- Added polyfills for
setInterval
andsetTimeout
in case other libraries expect these to exist. - Added much improved debugging for errors in the server JavaScript webpack file.
- See #244 for these improvements.
- New JavaScript API for debugging TurboLinks issues. Be sure to see turbolinks docs.
ReactOnRails.setOptions({ traceTurbolinks: true });
. Removed the filedebug_turbolinks
added in 2.1.1. See #243.
- Fixed regression where apps that were not using Turbolinks would not render components on page load.
ReactOnRails.render
returns a virtualDomElement Reference to your React component's backing instance. See #234.debug_turbolinks
helper for debugging turbolinks issues. See turbolinks.- Enhanced regression testing for non-turbolinks apps. Runs all tests for dummy app with turbolinks both disabled and enabled.
- Added EnsureAssetsCompiled feature so that you do not accidentally run tests without properly compiling the JavaScript bundles. Add a line to your
rails_helper.rb
file to check that the latest Webpack bundles have been generated prior to running tests that may depend on your client-side code. See docs for more detailed instructions. #222 - Added migration guide for migrating from React-Rails. #219
- Added React on Rails Doctrine to docs. Discusses the project's motivations, conventions, and principles. #220
- Added ability to skip
display:none
style in the generated content tag for a component. Some developers may want to disable inline styles for security reasons. See generated config initializer file for example on settingskip_display_none
. #218
- Changed message when running the dev (a.k.a. "express" server). #227
- Fixed handling of Turbolinks. Code was checking that Turbolinks was installed when it was not yet because some setups load Turbolinks after the bundles. The changes to the code will check if Turbolinks is installed after the page loaded event fires. Code was also added to allow easy debugging of Turbolinks, which should be useful when v5 of Turbolinks is released shortly. Details of how to configure Turbolinks with troubleshooting were added to docs/additional_reading/turbolinks.md. #221
- Fixed issue with already initialized constant warning appearing when starting a Rails server #226
- Fixed to make backwards compatible with Ruby v2.0 and updated all Ruby and Node dependencies.
- Added better messages after generator runs. #210
- Fixed bug with version matching between gem and npm package.
- Move JavaScript part of react_on_rails to npm package 'react-on-rails'.
- Converted JavaScript code to ES6! with tests!
- No global namespace pollution. ReactOnRails is the only global added.
- New API. Instead of placing React components on the global namespace, you instead call ReactOnRails.register, passing an object where keys are the names of your components:
import ReactOnRails from 'react-on-rails';
ReactOnRails.register({name: component});
Best done with Object destructing:
import ReactOnRails from 'react-on-rails';
ReactOnRails.register(
{
Component1,
Component2
}
);
Previously, you used
window.Component1 = Component1;
window.Component2 = Component2;
This would pollute the global namespace. See details in the README.md for more information.
- Your jade template for the WebpackDevServer setup should use the new API:
ReactOnRails.render(componentName, props, domNodeId);
such as:
ReactOnRails.render("HelloWorldApp", {name: "Stranger"}, 'app');
- All npm dependency libraries updated. Most notable is going to Babel 6.
- Dropped support for react 0.13.
- JS Linter uses ShakaCode JavaScript style: https://github.com/shakacode/style-guide-javascript
- Generators account these differences.
- Update the
react_on_rails
gem. - Remove
//= require react_on_rails
from any files such asapp/assets/javascripts/application.js
. This file comes from npm now. - Search you app for 'generator_function' and remove lines in layouts and rb files that contain it. Determination of a generator function is handled automatically.
- Find your files where you registered client and server globals, and use the new ReactOnRails.register syntax. Optionally rename the files
clientRegistration.jsx
andserverRegistration.jsx
rather thanGlobals
. - Update your index.jade to use the new API
ReactOnRails.render("MyApp", !{props}, 'app');
- Update your webpack files per the example commit. Remove globally exposing React and ReactDom, as well as their inclusion in the
entry
section. These are automatically included now. - Run
cd client && npm i --save react-on-rails
to get react-on-rails into yourclient/package.json
. - You should also update any other dependencies if possible to match up with the react-webpack-rails-tutorial. This includes updating to Babel 6.
- If you want to stick with Babel 5 for a bit, see Issue #238.
- Missing Lodash from generated package.json #175
- Rails 3.2 could not run generators #182
- Better placement of jquery_ujs dependency #171
- Add more detailed description when adding --help option to generator #161
- Lots of better docs.
- Support
--skip-bootstrap
or-b
option for generator. - Create examples tasks to test generated example apps.
- Fix non-server rendering configuration issues.
- Fix application.js incorrect overwritten issue.
- Fix Gemfile dependencies.
- Fix several generator issues.
- Removed templates/client folder.
- Support for React Router.
- Error and redirect handling.
- Turbolinks support.
- Fix several generator related issues. [Unreleased]: https://github.com/shakacode/react_on_rails/compare/3.0.3...master [3.0.3]: https://github.com/shakacode/react_on_rails/compare/3.0.2...3.0.3 [3.0.2]: https://github.com/shakacode/react_on_rails/compare/3.0.1...3.0.2 [3.0.1]: https://github.com/shakacode/react_on_rails/compare/3.0.0...3.0.1 [3.0.0]: https://github.com/shakacode/react_on_rails/compare/2.3.0...3.0.0 [2.3.0]: https://github.com/shakacode/react_on_rails/compare/2.2.0...2.3.0 [2.2.0]: https://github.com/shakacode/react_on_rails/compare/2.1.1...2.2.0 [2.1.1]: https://github.com/shakacode/react_on_rails/compare/v2.1.0...2.1.1 [2.1.0]: https://github.com/shakacode/react_on_rails/compare/v2.0.2...v2.1.0 [2.0.2]: https://github.com/shakacode/react_on_rails/compare/v2.0.1...v2.0.2 [2.0.1]: https://github.com/shakacode/react_on_rails/compare/v2.0.0...v2.0.1 [2.0.0]: https://github.com/shakacode/react_on_rails/compare/v1.2.2...v2.0.0 [1.2.2]: https://github.com/shakacode/react_on_rails/compare/v1.2.0...v1.2.2 [1.2.0]: https://github.com/shakacode/react_on_rails/compare/v1.1.0...v1.2.0 [1.1.1]: https://github.com/shakacode/react_on_rails/compare/v1.1.1...v1.0.0