Skip to content

Commit fb4b0e2

Browse files
fix(storage-browser): move useProcessTasks concurrency option to dispatch handler (#6528)
* fix(storage-browser): move useProcessTasks concurrency option to dispatch handler (#6525) * chore: fix publish-hotfix actions (#6527) * Version Packages * chore: bump size limit --------- Co-authored-by: Caleb Pollman <[email protected]>
1 parent 8867e2f commit fb4b0e2

File tree

16 files changed

+100
-67
lines changed

16 files changed

+100
-67
lines changed

.github/workflows/publish-hotfix.yml

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,46 +30,43 @@ jobs:
3030
uses: ./.github/actions/has-changesets
3131

3232
publish-hotfix:
33-
needs: [setup]
33+
needs: setup
3434
uses: ./.github/workflows/reusable-tagged-publish.yml
3535
with:
3636
dist-tag: hotfix
3737
secrets:
3838
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3939

4040
build-test:
41-
runs-on: ubuntu-latest
42-
needs: publish-hotfix
43-
environment: ci
41+
uses: ./.github/workflows/reusable-build-system-test.yml
42+
needs:
43+
- setup
44+
- publish-hotfix
4445
if: ${{ needs.setup.outputs.has-changesets != 'true' }}
45-
steps:
46-
- name: Build test v2
47-
uses: ./.github/workflows/reusable-build-system-test.yml
48-
with:
49-
dist-tag: hotfix
50-
env:
51-
AUTH_E2E_ROLE_ARN: ${{ secrets.AUTH_E2E_ROLE_ARN }}
52-
DOMAIN: ${{ secrets.DOMAIN }}
53-
PHONE_NUMBER: ${{ secrets.PHONE_NUMBER }}
54-
USERNAME: ${{ secrets.USERNAME }}
55-
NEW_PASSWORD: ${{ secrets.NEW_PASSWORD }}
56-
VALID_PASSWORD: ${{ secrets.VALID_PASSWORD }}
46+
with:
47+
dist-tag: hotfix
48+
secrets:
49+
AUTH_E2E_ROLE_ARN: ${{ secrets.AUTH_E2E_ROLE_ARN }}
50+
DOMAIN: ${{ secrets.DOMAIN }}
51+
PHONE_NUMBER: ${{ secrets.PHONE_NUMBER }}
52+
USERNAME: ${{ secrets.USERNAME }}
53+
NEW_PASSWORD: ${{ secrets.NEW_PASSWORD }}
54+
VALID_PASSWORD: ${{ secrets.VALID_PASSWORD }}
5755

5856
build-test-react-native:
59-
runs-on: ubuntu-latest
60-
needs: publish-hotfix
61-
environment: ci
57+
uses: ./.github/workflows/reusable-build-system-test-react-native.yml
58+
needs:
59+
- setup
60+
- publish-hotfix
6261
if: ${{ needs.setup.outputs.has-changesets != 'true' }}
63-
steps:
64-
- name: Build test v2 React Native
65-
uses: ./.github/workflows/reusable-build-system-test-react-native.yml
66-
with:
67-
dist-tag: hotfix
62+
with:
63+
dist-tag: hotfix
6864

6965
publish:
7066
runs-on: ubuntu-latest
7167
environment: deployment
7268
needs:
69+
- setup
7370
- build-test
7471
- build-test-react-native
7572
if: ${{ needs.setup.outputs.has-changesets != 'true' }}

.github/workflows/publish-latest.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ jobs:
6161
runs-on: ubuntu-latest
6262
environment: deployment
6363
needs:
64+
- setup
6465
- build-test
6566
- build-test-react-native
6667
if: ${{ needs.setup.outputs.has-changesets != 'true' }}

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
},
2626
"dependencies": {
2727
"@aws-amplify/ui-react": "6.11.1",
28-
"@aws-amplify/ui-react-storage": "3.10.1",
28+
"@aws-amplify/ui-react-storage": "3.10.2",
2929
"@docsearch/react": "3",
3030
"@mdx-js/loader": "^2.1.0",
3131
"@mdx-js/mdx": "^2.1.0",

examples/next-app-router/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"dependencies": {
1212
"@aws-amplify/ui-react": "6.11.1",
13-
"@aws-amplify/ui-react-storage": "3.10.1",
13+
"@aws-amplify/ui-react-storage": "3.10.2",
1414
"react": "^18.3.0",
1515
"next": "^14.2.25",
1616
"react-dom": "^18",

examples/next/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"@aws-amplify/ui-react-geo": "^2.2.8",
1616
"@aws-amplify/ui-react-liveness": "^3.3.8",
1717
"@aws-amplify/ui-react-notifications": "^2.2.8",
18-
"@aws-amplify/ui-react-storage": "^3.10.1",
18+
"@aws-amplify/ui-react-storage": "^3.10.2",
1919
"@aws-sdk/credential-providers": "^3.370.0",
2020
"next": "^14.2.25",
2121
"next-global-css": "^1.1.1",

examples/react-router/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
"dependencies": {
1313
"@aws-amplify/ui-react": "6.11.1",
14-
"@aws-amplify/ui-react-storage": "3.10.1",
14+
"@aws-amplify/ui-react-storage": "3.10.2",
1515
"react": "^18.3.1",
1616
"react-dom": "^18.3.1",
1717
"react-router-dom": "^7.1.3"

packages/react-storage/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @aws-amplify/ui-react-storage
22

3+
## 3.10.2
4+
5+
### Patch Changes
6+
7+
- [`cf63046c171b5dd349121d0d8bbf2282fb71aae4`](https://github.com/aws-amplify/amplify-ui/commit/cf63046c171b5dd349121d0d8bbf2282fb71aae4) Thanks [@calebpollman](https://github.com/calebpollman)! - fix(storage-browser): move useProcessTasks concurrency option to dispatch handler
8+
39
## 3.10.1
410

511
### Patch Changes

packages/react-storage/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@aws-amplify/ui-react-storage",
3-
"version": "3.10.1",
3+
"version": "3.10.2",
44
"main": "dist/index.js",
55
"module": "dist/esm/index.mjs",
66
"exports": {
@@ -66,7 +66,7 @@
6666
"name": "createStorageBrowser",
6767
"path": "dist/esm/browser.mjs",
6868
"import": "{ createStorageBrowser }",
69-
"limit": "64.13 kB",
69+
"limit": "64.19 kB",
7070
"ignore": [
7171
"@aws-amplify/storage"
7272
]

packages/react-storage/src/components/StorageBrowser/tasks/__tests__/useProcessTasks.spec.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,7 @@ describe('useProcessTasks', () => {
9191

9292
it('handles concurrent tasks as expected', async () => {
9393
const { result } = renderHook(() =>
94-
useProcessTasks(action, {
95-
concurrency: 2,
96-
items,
97-
onTaskProgress,
98-
})
94+
useProcessTasks(action, { items, onTaskProgress })
9995
);
10096

10197
const processTasks = result.current[1];
@@ -105,7 +101,7 @@ describe('useProcessTasks', () => {
105101
expect(result.current[0].tasks[2].status).toBe('QUEUED');
106102

107103
act(() => {
108-
processTasks({ config });
104+
processTasks({ config, options: { concurrency: 2 } });
109105
});
110106

111107
expect(action).toHaveBeenCalledTimes(2);
@@ -392,13 +388,13 @@ describe('useProcessTasks', () => {
392388

393389
it('returns `error` and `message` for a failed task and provides the expected values to `onTaskError`', async () => {
394390
const { result } = renderHook(() =>
395-
useProcessTasks(action, { concurrency: 2, items, onTaskError })
391+
useProcessTasks(action, { items, onTaskError })
396392
);
397393

398394
const processTasks = result.current[1];
399395

400396
act(() => {
401-
processTasks({ config });
397+
processTasks({ config, options: { concurrency: 2 } });
402398
});
403399

404400
expect(result.current[0].tasks[0].status).toBe('PENDING');

packages/react-storage/src/components/StorageBrowser/tasks/types.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
TaskData,
44
TaskResult,
55
TaskResultStatus,
6+
TaskHandlerOptions,
67
} from '../actions';
78

89
/**
@@ -17,8 +18,6 @@ export type TaskStatus = TaskResultStatus | 'QUEUED' | 'PENDING';
1718
export type StatusCounts = Record<TaskStatus | 'TOTAL', number>;
1819

1920
export interface ProcessTasksOptions<TTask extends Task, TItems = []> {
20-
// has no impact in atomic mode
21-
concurrency?: number;
2221
items?: TItems;
2322
onTaskCancel?: (task: TTask) => void;
2423
onTaskComplete?: (task: TTask) => void;
@@ -65,9 +64,19 @@ export type UseProcessTasksState<TTask, TInput> = [
6564
HandleProcessTasks<TInput>,
6665
];
6766

67+
interface HandleTasksOptions extends TaskHandlerOptions {
68+
concurrency?: number;
69+
}
70+
71+
export interface HandleBatchTasksInput<TData extends TaskData>
72+
extends Omit<TaskHandlerInput<TData, HandleTasksOptions>, 'data'> {}
73+
74+
export interface HandleSingleTaskInput<TData extends TaskData>
75+
extends TaskHandlerInput<TData> {}
76+
6877
export type InferHandleTasksInput<
6978
TItems,
7079
TData extends TaskData,
7180
> = TItems extends NonNullable<TItems>
72-
? Omit<TaskHandlerInput<TData>, 'data'>
73-
: TaskHandlerInput<TData>;
81+
? HandleBatchTasksInput<TData>
82+
: HandleSingleTaskInput<TData>;

0 commit comments

Comments
 (0)