Releases: davidkpiano/react-redux-form
React Redux Form v1.2.3
Fixes and Enhancements
- Prop types now correct for
<Form>
in that it can accept a function-as-children. #522 - New option for
formReducer()
:{ lazy: true }
allows lazy form/field initialization. #422 (read the form docs for more info) - TypeScript typings updated thanks to @tiagoefmoraes: #530
- You can now
import ... from 'react-redux-form/immutable'
directly: #511 - Validators in
<Control>
for subfields will now revalidate when the parent form is reset: #519 - Model value is updated to last loaded value after reset: #533
- Sub fields are now properly validated for nested structures: #528
React Redux Form v1.2.2
More Quick Fixes
- Removing propTypes warnings for invalid prop type
"store"
- Now,
updateOn={...}
in<LocalForm>
is called when the local form value actually changes (determined withshallowEqual
). This prevents infinite loops.
React Redux Form v1.2.1
Fixes and Enhancements
- The dependency on
redux-thunk
is being removed from all internal RRF components. That means that if you're using standard RRF components, you don't needredux-thunk
, but if you are dispatching actions from the library, some might require the use ofredux-thunk
. - A couple fixes to
<LocalForm>
- now renders a
<form>
by default, instead of a<div>
(oops) - invalid proptypes are prevented from leaking in to child components
- now renders a
React Redux Form v1.2.0
Local Forms 🚀
Local Forms are here! If you've ever asked the question:
Why would I want to keep my form state in a global Redux store, when form state is supposed to be local?
then <LocalForm>
is for you. Here's what it looks like:
import React from 'react';
import { LocalForm, Control } from 'react-redux-form';
export default class MyApp extends React.Component {
handleChange(values) { ... }
handleUpdate(form) { ... }
render() {
return (
<LocalForm
onUpdate={(form) => this.handleUpdate(form)}
onChange={(values) => this.handleChange(values)}
>
<Control.text model=".username" />
<Control.text model=".password" />
</LocalForm>
);
}
}
That's right; you don't even need to setup Redux if you're using <LocalForm>
. The entire form and model state of your isolated local form are kept in internal component state. Any <Control>
, <Errors>
, <Field>
, etc. will continue to work inside of <LocalForm>
.
👉 Read the docs to find out more about <LocalForm>
. #420
React Redux Form v1.1.0
Documentation Updates
- Docs on using RRF with Immutable.JS were published: http://davidkpiano.github.io/react-redux-form/docs/guides/immutable.html
- Fixed typo in docs:
setAsyncValidity
should actually beasyncSetValidity
. #506
Under the hood
- Lots of code was refactored, simplified, and removed in RRF v1.1.0, without sacrificing any features or flexibility.
- Included in these enhancements is a new intents system, which is a declarative way to describe secondary effects based on actions previously completed. For example, if you dispatch
actions.focus(model)
, then the form reducer will:- update the
.focus
state of that field - add an intent that the actual control on the DOM should be focused
- update the
Then, the <Control>
component can handle that intent, focus the DOM node, and clear the intent, so that it doesn't run again.
Bug fixes and enhancements
- All proper propTypes added for
<Fieldset>
(not yet documented). #504 novalidate
->noValidate
because, you know, React. #505- Field validation inside a
<Form>
now accurately takes into account mixed form and field validators, thanks to the new intent system. #513 - Options for callback functions in
actions.setFieldsValidity()
(which were only being used internally, and not documented) are removed for simplicity. Intents are used instead. - Loading complex models (via
actions.load(model, {complex: 'stuff'})
) now properly updates the field and subField states. #516 - The
in
operator is now avoided for non object types, when determining how to retrieve a substate from a (potentially) immutable object. #514 - Icepick doesn't like it when you try to associate a value via an empty path. Fixed that. #512
React Redux Form v1.0.15
React Redux Form v1.0.14
Small Fixes
- Numbers are now passed thru as numbers instead of strings to text components. Should not affect existing components - this was fixed due to an edge case in #487.
- Clarified in docs that you can not nest
<form>
elements - it is invalid HTML. Use<Form component="div" ...>
instead, if you must. #490 - Production builds will no longer break due to an
Errors.propTypes is undefined
error. Prop types are removed from components in production builds for performance. #491
React Redux Form v1.0.13
Fixes and Enhancements
- Thanks to @tiagoefmoraes for continuing to work on the TypeScript definition file! #484
- The side-effectful
actions.focus
is now properly handled (with an intents system under the hood), and you can now specify which specific control you'd like to focus:
// will focus the radio button with value = "A"
actions.focus('user.choice', 'A');
// will focus all the radio buttons, eventually just
// leaving the last radio button in focus.
// This may or may not be desirable, keep this in mind!
actions.focus('user.choice');
// if there is only one control, this will work like normal
actions.focus('user.name');
This is useful if there are many controls (e.g. radio buttons) associated to a single model. #478
- The
submitFailed
value now updates the child fields recursively. #462 - Custom
changeAction={...}
props for checkboxes will now take the relevant value as the second argument (wasundefined
before). #474- For single checkboxes, the value will be the expected value that it will toggle to. So if
user.active == true
and you click the checkbox, it will pass infalse
as the second arg. - For multi checkboxes, the value passed in will be the value clicked.
- For single checkboxes, the value will be the expected value that it will toggle to. So if
React Redux Form v1.0.12
Fixes and Enhancements
- The
invariant
package was added as a new tiny dependency, in order to be more helpful to developers for catching simple errors in non-dev environments. #472 - The Babel plugin
transform-react-remove-prop-types
wraps RRF componentpropTypes
so that they are stripped in production. - The TypeScript declaration file was updated by @zach-waggoner, huge thanks to him! #479
- The wrapper
component={...}
prop for<Field>
can now benull
, only if there is a single child element (as React cannot render fragments of multiple children yet). #482 - Calling
actions.setPristine(...)
will now properly recursively update all child fields withpristine = true
. #432
React Redux Form v1.0.11
Fixes and Enhancements
- Dispatching
actions.reset(...)
now resets the value to the last initial value created byactions.load
(or the original initial value if this does not apply). #426 - The
validateOn={[...]}
prop now detects multiple events. #454 - The
.valid
prop is now reset correctly for child fields when validity for a parent model is reset. #463 - When a field is changed/made dirty, the pristine value is now correctly set. #464
- Disallowed/unknown props are stripped from rendered components in
<Control>
to prevent React warnings. #465 #468