Skip to content

Commit 02fdc30

Browse files
authored
chore: adjust retry times (#309)
* chore: adjust retry times * test: upgrade * chore: merge config * chore: update deps * chore: fix CI peer break. I am sorry * chore: update test deps * chore: comment * chore: update script * chore: update cov script
1 parent f5fb0e9 commit 02fdc30

File tree

6 files changed

+20
-24
lines changed

6 files changed

+20
-24
lines changed

.fatherrc.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
export default {
2-
cjs: 'babel',
3-
esm: { type: 'babel', importLibToEs: true },
4-
preCommit: {
5-
eslint: true,
6-
prettier: true,
7-
},
8-
runtimeHelpers: true,
9-
};
1+
import { defineConfig } from 'father';
2+
3+
export default defineConfig({
4+
plugins: ['@rc-component/father-plugin'],
5+
});

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
- uses: actions/setup-node@v1
1717
with:
18-
node-version: '12'
18+
node-version: '16'
1919

2020
- name: cache package-lock.json
2121
uses: actions/cache@v2
@@ -42,7 +42,7 @@ jobs:
4242

4343
- name: install
4444
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
45-
run: npm ci
45+
run: npm i
4646

4747
lint:
4848
runs-on: ubuntu-latest

jest.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
module.exports = {
22
setupFiles: ['./tests/setup.js'],
3-
setupFilesAfterEnv: ['@testing-library/jest-dom/extend-expect'],
43
};

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
"compile": "father build && lessc assets/index.less assets/index.css",
3636
"prepublishOnly": "npm run compile && np --yolo --no-publish",
3737
"lint": "eslint src/ docs/examples/ --ext .tsx,.ts,.jsx,.js",
38-
"test": "father test",
39-
"coverage": "father test --coverage",
38+
"test": "rc-test",
39+
"coverage": "rc-test --coverage",
4040
"now-build": "npm run build"
4141
},
4242
"devDependencies": {
@@ -49,13 +49,15 @@
4949
"cross-env": "^7.0.1",
5050
"dumi": "^1.1.38",
5151
"eslint": "^7.0.0",
52-
"father": "^2.30.2",
52+
"father": "^4.0.0",
5353
"less": "^3.10.3",
5454
"np": "^6.2.0",
55+
"rc-test": "^7.0.13",
5556
"react": "^18.0.0",
5657
"react-dom": "^18.0.0",
5758
"regenerator-runtime": "^0.13.7",
58-
"typescript": "^4.0.0"
59+
"typescript": "^4.0.0",
60+
"@rc-component/father-plugin": "^1.0.0"
5961
},
6062
"dependencies": {
6163
"@babel/runtime": "^7.18.3",
@@ -68,4 +70,4 @@
6870
"react": ">=16.9.0",
6971
"react-dom": ">=16.9.0"
7072
}
71-
}
73+
}

src/Popup/PopupInner.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ const PopupInner = React.forwardRef<PopupInnerRef, PopupInnerProps>(
111111
* We will reset `alignTimes` for each status switch to `alignPre`
112112
* and let `rc-align` to align for multiple times to ensure get final stable place.
113113
* Currently we mark `alignTimes < 2` repeat align, it will increase if user report for align issue.
114+
*
115+
* Update:
116+
* In React 18. `rc-align` effect of align may faster than ref called trigger `forceAlign`.
117+
* We adjust this to `alignTimes < 2`.
118+
* We need refactor `rc-align` to support mark of `forceAlign` call if this still happen.
114119
*/
115120
const [alignTimes, setAlignTimes] = useState(0);
116121
const prepareResolveRef = useRef<(value?: unknown) => void>();
@@ -153,7 +158,7 @@ const PopupInner = React.forwardRef<PopupInnerRef, PopupInnerProps>(
153158
useLayoutEffect(() => {
154159
if (status === 'align') {
155160
// Repeat until not more align needed
156-
if (alignTimes < 2) {
161+
if (alignTimes < 3) {
157162
forceAlign();
158163
} else {
159164
goNextStatus(function () {

tests/setup.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
require('regenerator-runtime/runtime');
2-
3-
window.requestAnimationFrame = (func) => {
4-
window.setTimeout(func, 16);
5-
};
6-
71
// jsdom add motion events to test CSSMotion
82
window.AnimationEvent = window.AnimationEvent || (() => {});
93
window.TransitionEvent = window.TransitionEvent || (() => {});

0 commit comments

Comments
 (0)