Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

Commit

Permalink
Merge #985
Browse files Browse the repository at this point in the history
985: Stop using `.toArray` for Immutable Maps r=jaredkerim a=rehandalal

Fixes #981. 

`.toArray` was changed in a recent version of Immutable. It used to discard the keys and return a flattened array of values. This call to `.reduce` recreates the previous implementation of `.toArray`.

r?

Co-authored-by: Rehan Dalal <rehandalal@gmail.com>
  • Loading branch information
bors[bot] and rehandalal committed Aug 13, 2019
2 parents df0da0d + 02b61d8 commit d4eaed6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
18 changes: 13 additions & 5 deletions src/workflows/recipes/components/FilterObjectForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class FilterObjectForm extends React.PureComponent {
.map(channel => {
return { label: channel.get('value'), value: channel.get('key') };
})
.toArray()
.reduce((reduction, value) => [...reduction, value], [])
.sort((a, b) => {
// The reason why we sort my *label* is because that's the only thing presented
// to users' eyes. What the default sort is or what the order by 'key' is not
Expand Down Expand Up @@ -309,10 +309,18 @@ class FilterObjectForm extends React.PureComponent {
// This is a simple object for counting how many settings have been set per tab.
const countSettings = this.getSettingsCounts();

const initialLocales = filterObject.get('locales', List()).toArray();
const initialCountries = filterObject.get('countries', List()).toArray();
const initialChannels = filterObject.get('channels', List()).toArray();
const initialVersions = filterObject.get('versions', List()).toArray();
const initialLocales = filterObject
.get('locales', List())
.reduce((reduction, value) => [...reduction, value], []);
const initialCountries = filterObject
.get('countries', List())
.reduce((reduction, value) => [...reduction, value], []);
const initialChannels = filterObject
.get('channels', List())
.reduce((reduction, value) => [...reduction, value], []);
const initialVersions = filterObject
.get('versions', List())
.reduce((reduction, value) => [...reduction, value], []);
const initialSampling = filterObject.get('_sampling', Map()).toJS();

const tabLabels = {
Expand Down
2 changes: 1 addition & 1 deletion src/workflows/recipes/components/RecipeDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default class RecipeDetails extends React.PureComponent {
actionName={actionName}
/>,
])
.toArray()}
.reduce((reduction, value) => [...reduction, value], [])}
</dl>
</Card>
</div>
Expand Down

0 comments on commit d4eaed6

Please sign in to comment.