mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-27 01:25:52 -05:00
Remove option
warning in console
`option` throws an error in React if it’s not a string. `FormattedMessage` returns a `span` around strings, so any time this function was loaded/called, it was throwing >100 warnings in the console. use `intl` to return a string instead.
This commit is contained in:
parent
6d5bb4f850
commit
0d9493de12
1 changed files with 9 additions and 4 deletions
|
@ -27,9 +27,14 @@ var Tooltip = require('../../components/tooltip/tooltip.jsx');
|
||||||
require('./steps.scss');
|
require('./steps.scss');
|
||||||
|
|
||||||
var DEFAULT_COUNTRY = 'us';
|
var DEFAULT_COUNTRY = 'us';
|
||||||
var getCountryOptions = function (defaultCountry) {
|
var getCountryOptions = function (defaultCountry, intl) {
|
||||||
|
if (typeof intl === 'undefined') {
|
||||||
|
intl = defaultCountry;
|
||||||
|
defaultCountry = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
var options = countryData.countryOptions.concat({
|
var options = countryData.countryOptions.concat({
|
||||||
label: <intl.FormattedMessage id="registration.selectCountry" />,
|
label: intl.formatMessage({id: 'registration.selectCountry'}),
|
||||||
disabled: true,
|
disabled: true,
|
||||||
selected: true
|
selected: true
|
||||||
});
|
});
|
||||||
|
@ -347,7 +352,7 @@ module.exports = {
|
||||||
</div>
|
</div>
|
||||||
<Select label={formatMessage({id: 'general.country'})}
|
<Select label={formatMessage({id: 'general.country'})}
|
||||||
name="user.country"
|
name="user.country"
|
||||||
options={getCountryOptions(DEFAULT_COUNTRY)}
|
options={getCountryOptions(DEFAULT_COUNTRY, this.props.intl)}
|
||||||
required />
|
required />
|
||||||
<Checkbox className="demographics-checkbox-is-robot"
|
<Checkbox className="demographics-checkbox-is-robot"
|
||||||
label="I'm a robot!"
|
label="I'm a robot!"
|
||||||
|
@ -660,7 +665,7 @@ module.exports = {
|
||||||
<Form onValidSubmit={this.onValidSubmit}>
|
<Form onValidSubmit={this.onValidSubmit}>
|
||||||
<Select label={formatMessage({id: 'general.country'})}
|
<Select label={formatMessage({id: 'general.country'})}
|
||||||
name="address.country"
|
name="address.country"
|
||||||
options={getCountryOptions()}
|
options={getCountryOptions(this.props.intl)}
|
||||||
value={this.props.defaultCountry}
|
value={this.props.defaultCountry}
|
||||||
onChange={this.onChangeCountry}
|
onChange={this.onChangeCountry}
|
||||||
required />
|
required />
|
||||||
|
|
Loading…
Reference in a new issue