Skip to content

Commit bc7030d

Browse files
authored
Remove outdated Babel spread optimization from selectors (#50987)
1 parent 0622788 commit bc7030d

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

packages/data/src/redux-store/index.js

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -371,23 +371,8 @@ function instantiateReduxStore( key, options, registry, thunkArgs ) {
371371
*/
372372
function mapSelectors( selectors, store ) {
373373
const createStateSelector = ( registrySelector ) => {
374-
const selector = function runSelector() {
375-
// This function is an optimized implementation of:
376-
//
377-
// selector( store.getState(), ...arguments )
378-
//
379-
// Where the above would incur an `Array#concat` in its application,
380-
// the logic here instead efficiently constructs an arguments array via
381-
// direct assignment.
382-
const argsLength = arguments.length;
383-
const args = new Array( argsLength + 1 );
384-
args[ 0 ] = store.__unstableOriginalGetState();
385-
for ( let i = 0; i < argsLength; i++ ) {
386-
args[ i + 1 ] = arguments[ i ];
387-
}
388-
389-
return registrySelector( ...args );
390-
};
374+
const selector = ( ...args ) =>
375+
registrySelector( store.__unstableOriginalGetState(), ...args );
391376
selector.hasResolver = false;
392377
return selector;
393378
};

0 commit comments

Comments
 (0)