insin / insin/newforms

No re-render when changing field choices

Open
#67 6 comments 0 reactions 0 assignees View on GitHub
Enhancement HasWorkaround
Dominant language
JavaScript
Stars
634
Forks
46
PR merge metrics
No merged PRs in 30d

Description

In the following example, setting the ChoiceField's choices does not cause a redraw
If I force a redraw, then I see the form correctly displayed.

I expected that setChoices would do a redraw on it's own.

``` javascript
var React = require("react");
var forms = require("newforms");
var IPIN = forms.Form.extend({
device: forms.ChoiceField(),
});
var IPINform = new IPIN();

var Thing = React.createClass({
getInitialState: function(){
return {form: IPINform};
},
forceupdate: function(){
this.forceUpdate();
},
render: function(){
return (


submit

);
}
});

var r = React.render(, document.body);

setTimeout(function(){
IPINform.fields.device.setChoices(["eth0", "eth1"]);
// If I add this, it works:
// r.forceupdate();
}, 100);
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.