Remove unnecessary sort
This commit is contained in:
parent
7036804c67
commit
d99caa43fc
@ -14,14 +14,13 @@ export function useWalletPayment () {
|
|||||||
// XXX calling hooks in a loop is against the rules of hooks
|
// XXX calling hooks in a loop is against the rules of hooks
|
||||||
//
|
//
|
||||||
// we do this here anyway since we need the logger for each wallet.
|
// we do this here anyway since we need the logger for each wallet.
|
||||||
// we ensure hooks are always called in the same order by sorting the wallets by name.
|
// hooks are always called in the same order since walletDefs does not change between renders.
|
||||||
//
|
//
|
||||||
// we don't use the return value of useWallets here because it is empty on first render
|
// we don't use the return value of useWallets here because it is empty on first render
|
||||||
// so using it would change the order of the hooks between renders.
|
// so using it would change the order of the hooks between renders.
|
||||||
//
|
//
|
||||||
// see https://react.dev/reference/rules/rules-of-hooks
|
// see https://react.dev/reference/rules/rules-of-hooks
|
||||||
const loggers = walletDefs
|
const loggers = walletDefs
|
||||||
.sort((def1, def2) => def1.name.localeCompare(def2.name))
|
|
||||||
.reduce((acc, def) => {
|
.reduce((acc, def) => {
|
||||||
return {
|
return {
|
||||||
...acc,
|
...acc,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user