1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-23 11:46:13 +02:00
metamask-extension/ui/app
Whymarrh Whitby c4a3d4ea82 Remove unneeded array cloning in getSendToAccounts selector
The use of `Object.entries` here to map the accounts into a new array effectively
produces a shallow clone of the array without guaranteeing the order of the original
array (as object iteration order is implementation-specific and variable). From MDN [1]:

> The **`Object.entries()`** method returns an array of a given object's own enumerable
> string-keyed property `[key, value]` pairs, in the same order as that provided by a
> `for...in` loop

And also:

> The ordering of the properties is the same as that given by looping over the
> property values of the object manually.

Both of which suggest that the iteration order is the same as `for...in`, which is to
say that it's not specified. [2] [3]

This changeset removes the cloning, keeping the shallow clone created the line before
which preserves the order of the items in the array.

  [1]:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries
  [2]:https://stackoverflow.com/a/5525820/1267663
  [3]:https://stackoverflow.com/a/30919039/1267663
2019-04-11 21:50:06 -02:30
..
components Remove unneeded array cloning in getSendToAccounts selector 2019-04-11 21:50:06 -02:30
css New settings page rebased (#6333) 2019-03-25 13:43:23 -02:30
ducks Fix display of gas chart on Ethereum networks (#6389) 2019-04-03 13:31:43 -02:30
helpers Metrics tracking gas changed - slow, average, fast, custom - on edit screen.- 2019-04-08 11:06:05 -02:30
pages Only pass english function names to functionType metric 2019-04-08 13:31:11 -02:30
selectors Fix display of gas chart on Ethereum networks (#6389) 2019-04-03 13:31:43 -02:30
store Remove NoticeController (#6382) 2019-04-01 22:33:54 -02:30