Skip to content

Commit 5dc30a0

Browse files
committed
fix: fix
2 parents 58ca561 + 89c66be commit 5dc30a0

File tree

25 files changed

+46
-24142
lines changed

25 files changed

+46
-24142
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Get pnpm store directory
2121
id: pnpm-cache
2222
run: |
23-
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
23+
echo "pnpm_cache_dir=$(pnpm store path)" >> "$GITHUB_OUTPUT"
2424
2525
- name: Setup pnpm cache
2626
uses: actions/cache@v3

config/config.ts

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ export default {
99
type: 'none',
1010
exclude: [],
1111
},
12+
// https://github.com/alibaba/hooks/issues/2155
13+
extraBabelIncludes: ['filter-obj'],
1214
extraBabelPlugins: [
1315
[
1416
'babel-plugin-import',

jest.config.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/** esm modules to transform */
2+
const esmModules = [
3+
// `query-string` and its related dependencies
4+
'query-string',
5+
'decode-uri-component',
6+
'split-on-first',
7+
'filter-obj',
8+
];
9+
110
module.exports = {
211
preset: 'ts-jest/presets/js-with-ts',
312
testEnvironment: 'jsdom',
@@ -18,7 +27,7 @@ module.exports = {
1827
'!**/lib/**',
1928
'!**/dist/**',
2029
],
21-
transformIgnorePatterns: ['^.+\\.js$'],
30+
transformIgnorePatterns: [`node_modules/(?!(?:.pnpm/)?(${esmModules.join('|')}))`],
2231
moduleNameMapper: {
2332
'lodash-es': 'lodash',
2433
},

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@
6868
"react-shadow": "^19.0.3",
6969
"rimraf": "^3.0.2",
7070
"surge": "^0.21.3",
71-
"ts-jest": "^29.0.5",
71+
"ts-jest": "^29.1.1",
7272
"typescript": "^5.1.3",
73-
"webpack": "^4.43.0",
74-
"webpack-cli": "^3.3.10",
73+
"webpack": "^5.88.2",
74+
"webpack-cli": "^5.1.4",
7575
"webpack-merge": "^4.2.2"
7676
},
7777
"commitlint": {

packages/hooks/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ahooks",
3-
"version": "3.7.8",
3+
"version": "3.7.9",
44
"description": "react hooks library",
55
"keywords": [
66
"ahooks",

packages/hooks/src/useAntdTable/demo/cache.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ const UserList = () => {
136136
return (
137137
<div>
138138
{type === 'simple' ? searchForm : advanceSearchForm}
139-
<Table columns={columns} rowKey="email" {...tableProps} />
139+
<Table columns={columns} rowKey="email" style={{ overflow: 'auto' }} {...tableProps} />
140140

141141
<div style={{ background: '#f5f5f5', padding: 8 }}>
142142
<p>Current Table:</p>

packages/hooks/src/useAntdTable/demo/form.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export default () => {
122122
return (
123123
<div>
124124
{type === 'simple' ? searchForm : advanceSearchForm}
125-
<Table columns={columns} rowKey="email" {...tableProps} />
125+
<Table columns={columns} rowKey="email" style={{ overflow: 'auto' }} {...tableProps} />
126126

127127
<div style={{ background: '#f5f5f5', padding: 8 }}>
128128
<p>Current Table:</p>

packages/hooks/src/useAntdTable/demo/init.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export default () => {
126126
return (
127127
<div>
128128
{type === 'simple' ? searchForm : advanceSearchForm}
129-
<Table columns={columns} rowKey="email" {...tableProps} />
129+
<Table columns={columns} rowKey="email" style={{ overflow: 'auto' }} {...tableProps} />
130130

131131
<div style={{ background: '#f5f5f5', padding: 8 }}>
132132
<p>Current Table:</p>

packages/hooks/src/useAntdTable/demo/ready.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export default () => {
131131
<div>
132132
<Button onClick={() => setReady((r) => !r)}>toggle ready</Button>
133133
{type === 'simple' ? searchForm : advanceSearchForm}
134-
<Table columns={columns} rowKey="email" {...tableProps} />
134+
<Table columns={columns} rowKey="email" style={{ overflow: 'auto' }} {...tableProps} />
135135

136136
<div style={{ background: '#f5f5f5', padding: 8 }}>
137137
<p>Current Table:</p>

packages/hooks/src/useAntdTable/demo/table.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@ export default () => {
4949
},
5050
];
5151

52-
return <Table columns={columns} rowKey="email" {...tableProps} />;
52+
return <Table columns={columns} rowKey="email" style={{ overflow: 'auto' }} {...tableProps} />;
5353
};

packages/hooks/src/useAntdTable/demo/validate.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export default () => {
8888
return (
8989
<div>
9090
{searchForm}
91-
<Table columns={columns} rowKey="email" {...tableProps} />
91+
<Table columns={columns} rowKey="email" style={{ overflow: 'auto' }} {...tableProps} />
9292

9393
<div style={{ background: '#f5f5f5', padding: 8 }}>
9494
<p>Current Table:</p>

packages/hooks/src/useDocumentVisibility/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const getVisibility = () => {
1212
};
1313

1414
function useDocumentVisibility(): VisibilityState {
15-
const [documentVisibility, setDocumentVisibility] = useState(() => getVisibility());
15+
const [documentVisibility, setDocumentVisibility] = useState(getVisibility);
1616

1717
useEventListener(
1818
'visibilitychange',

packages/hooks/src/useDrop/demo/demo1.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ export default () => {
7070
{isHovering ? 'release here' : 'drop here'}
7171
</div>
7272

73-
<div style={{ display: 'flex', marginTop: 8 }}>
74-
{['1', '2', '3', '4', '5'].map((e, i) => (
73+
<div style={{ display: 'flex', marginTop: 8, overflow: 'auto' }}>
74+
{['1', '2', '3', '4', '5'].map((e) => (
7575
<DragItem key={e} data={e} />
7676
))}
7777
</div>

packages/hooks/src/useDynamicList/demo/demo4.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export default () => {
8484
dataSource={list}
8585
rowKey={(r: Item, index: number) => getKey(index).toString()}
8686
pagination={false}
87+
style={{ overflow: 'auto' }}
8788
/>
8889
</ReactDragListView>
8990
</Form>

packages/hooks/src/useInViewport/index.en-US.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ const [inViewport, ratio] = useInViewport(
3434

3535
### Params
3636

37-
| Property | Description | Type | Default |
38-
| -------- | ---------------------------------- | ---------------------- | ------- |
39-
| target | DOM elements or Ref, support array | `Target` \| `Target[]` | - |
40-
| options | Setting | `Options` | - |
37+
| Property | Description | Type | Default |
38+
| -------- | ---------------------------------- | ------------------------ | ------- |
39+
| target | DOM elements or Ref, support array | `Target` \| `Target[]` | - |
40+
| options | Setting | `Options` \| `undefined` | - |
4141

4242
### Options
4343

packages/hooks/src/useInViewport/index.zh-CN.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ const [inViewport, ratio] = useInViewport(
3434

3535
### Params
3636

37-
| 参数 | 说明 | 类型 | 默认值 |
38-
| ------- | -------------------------- | ---------------------- | ------ |
39-
| target | DOM 节点或者 Ref,支持数组 | `Target` \| `Target[]` | - |
40-
| options | 设置 | `Options` | - |
37+
| 参数 | 说明 | 类型 | 默认值 |
38+
| ------- | -------------------------- | ------------------------ | ------ |
39+
| target | DOM 节点或者 Ref,支持数组 | `Target` \| `Target[]` | - |
40+
| options | 设置 | `Options` \| `undefined` | - |
4141

4242
### Options
4343

packages/hooks/src/useInfiniteScroll/index.en-US.md

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ const {
6969
data: TData;
7070
loading: boolean;
7171
loadingMore: boolean;
72+
error?: Error;
7273
noMore: boolean;
7374
loadMore: () => void;
7475
loadMoreAsync: () => Promise<TData>;

packages/hooks/src/useInfiniteScroll/index.zh-CN.md

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ const {
6969
data: TData;
7070
loading: boolean;
7171
loadingMore: boolean;
72+
error?: Error;
7273
noMore: boolean;
7374
loadMore: () => void;
7475
loadMoreAsync: () => Promise<TData>;

packages/hooks/src/useInfiniteScroll/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export interface InfiniteScrollResult<TData extends Data> {
99
data: TData;
1010
loading: boolean;
1111
loadingMore: boolean;
12+
error?: Error;
1213
noMore: boolean;
1314

1415
loadMore: () => void;

packages/hooks/src/useTimeout/index.en-US.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ A hook that handles the `setTimeout` timer function.
1919
```typescript
2020
useTimeout(
2121
fn: () => void,
22-
delay?: number | null
22+
delay?: number | undefined
2323
): fn: () => void;
2424
```
2525

packages/hooks/src/useTimeout/index.zh-CN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ nav:
1919
```typescript
2020
useTimeout(
2121
fn: () => void,
22-
delay?: number | null
22+
delay?: number | undefined
2323
): fn: () => void;
2424
```
2525

packages/use-url-state/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"dependencies": {
3535
"@babel/runtime": "^7.21.0",
3636
"ahooks": "^3.4.1",
37-
"query-string": "^6.9.0",
37+
"query-string": "^8.1.0",
3838
"tslib": "^2.4.1"
3939
},
4040
"gitHead": "11f6ad571bd365c95ecb9409ca3050cbbfc9b34a"

packages/use-url-state/src/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useMemoizedFn, useUpdate } from 'ahooks';
2-
import { parse, stringify } from 'query-string';
2+
import qs from 'query-string';
33
import type { ParseOptions, StringifyOptions } from 'query-string';
44
import { useMemo, useRef } from 'react';
55
import type * as React from 'react';
@@ -50,7 +50,7 @@ const useUrlState = <S extends UrlState = UrlState>(
5050
);
5151

5252
const queryFromUrl = useMemo(() => {
53-
return parse(location.search, mergedParseOptions);
53+
return qs.parse(location.search, mergedParseOptions);
5454
}, [location.search]);
5555

5656
const targetQuery: State = useMemo(
@@ -71,7 +71,7 @@ const useUrlState = <S extends UrlState = UrlState>(
7171
history[navigateMode](
7272
{
7373
hash: location.hash,
74-
search: stringify({ ...queryFromUrl, ...newQuery }, mergedStringifyOptions) || '?',
74+
search: qs.stringify({ ...queryFromUrl, ...newQuery }, mergedStringifyOptions) || '?',
7575
},
7676
location.state,
7777
);
@@ -80,7 +80,7 @@ const useUrlState = <S extends UrlState = UrlState>(
8080
navigate(
8181
{
8282
hash: location.hash,
83-
search: stringify({ ...queryFromUrl, ...newQuery }, mergedStringifyOptions) || '?',
83+
search: qs.stringify({ ...queryFromUrl, ...newQuery }, mergedStringifyOptions) || '?',
8484
},
8585
{
8686
replace: navigateMode === 'replace',

0 commit comments

Comments
 (0)