Skip to content

Commit d98c91c

Browse files
committed
Merge branch 'master' into feature/remove-connectadvanced
2 parents c7c2f0c + a3503c1 commit d98c91c

19 files changed

+2721
-2468
lines changed

.github/workflows/test.yml

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches: [master, typescript-port]
66
pull_request:
77
branches: [master, typescript-port]
8+
workflow_dispatch:
89

910
jobs:
1011
build:

jest.config.js

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
1+
const { defaults: tsjPreset } = require('ts-jest/presets')
2+
13
const defaults = {
24
coverageDirectory: './coverage/',
35
collectCoverage: true,
46
testURL: 'http://localhost',
57
}
6-
const testFolderPath = (folderName) => `<rootDir>/test/${folderName}/**/*.js`
78

89
const NORMAL_TEST_FOLDERS = ['components', 'hooks', 'integration', 'utils']
910

10-
const standardConfig = {
11-
...defaults,
12-
displayName: 'ReactDOM',
13-
testMatch: NORMAL_TEST_FOLDERS.map(testFolderPath),
14-
}
15-
1611
const tsTestFolderPath = (folderName) =>
1712
`<rootDir>/test/${folderName}/**/*.{ts,tsx}`
1813

@@ -26,13 +21,14 @@ const tsStandardConfig = {
2621
const rnConfig = {
2722
...defaults,
2823
displayName: 'React Native',
29-
testMatch: [testFolderPath('react-native')],
24+
testMatch: [tsTestFolderPath('react-native')],
3025
preset: 'react-native',
3126
transform: {
3227
'^.+\\.js$': '<rootDir>/node_modules/react-native/jest/preprocessor.js',
28+
...tsjPreset.transform,
3329
},
3430
}
3531

3632
module.exports = {
37-
projects: [tsStandardConfig, standardConfig, rnConfig],
33+
projects: [tsStandardConfig, rnConfig],
3834
}

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,12 @@
8080
"@testing-library/react": "^12.0.0",
8181
"@testing-library/react-hooks": "^3.4.2",
8282
"@testing-library/react-native": "^7.1.0",
83+
"@types/create-react-class": "^15.6.3",
8384
"@types/object-assign": "^4.0.30",
8485
"@types/react": "^17.0.14",
8586
"@types/react-dom": "^17.0.9",
8687
"@types/react-is": "^17.0.1",
88+
"@types/react-native": "^0.64.12",
8789
"@types/react-redux": "^7.1.18",
8890
"@typescript-eslint/eslint-plugin": "^4.28.0",
8991
"@typescript-eslint/parser": "^4.28.0",

src/hooks/useSelector.ts

+5
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ function useSelectorWithStoreAndSubscription<TStoreState, TSelectedState>(
7171
function checkForUpdates() {
7272
try {
7373
const newStoreState = store.getState()
74+
// Avoid calling selector multiple times if the store's state has not changed
75+
if (newStoreState === latestStoreState.current) {
76+
return
77+
}
78+
7479
const newSelectedState = latestSelector.current!(newStoreState)
7580

7681
if (equalityFn(newSelectedState, latestSelectedState.current)) {

0 commit comments

Comments
 (0)