Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(react-storage): refactor useView action related hooks #5998

Merged
merged 14 commits into from
Nov 7, 2024

Conversation

Samaritan1011001
Copy link
Member

@Samaritan1011001 Samaritan1011001 commented Nov 1, 2024

Description of changes

  • add useUploadView
  • align useView action interfaces
  • move view button disabling logic to components
  • add statusCounts, isProcessing and isProcessingComplete values to useProcessTasks return

Issue #, if available

Description of how you validated changes

Unit tests

Checklist

  • Have read the Pull Request Guidelines
  • PR description included
  • yarn test passes and tests are updated/added
  • PR title and commit messages follow conventional commit syntax
  • If this change should result in a version bump, changeset added (This can be done after creating the PR.) This does not apply to changes made to docs, e2e, examples, or other private packages.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link

changeset-bot bot commented Nov 1, 2024

⚠️ No Changeset found

Latest commit: 731f099

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@calebpollman calebpollman changed the title feat(react-storage): useUploadView feat(react-storage): refactor useView action related hooks Nov 6, 2024
Comment on lines -36 to +34
const destinationPath = `${path}${getFilenameWithoutPrefix(sourcePath)}`;
const destinationPath = `${path}${fileKey}`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the approach here to allow to improve consumer ergonomics by providing just the parsed fileKey as well as the full key

@@ -1,17 +1,15 @@
import { copy } from '../../storage-internal';
import { getFilenameWithoutPrefix } from '../../views/LocationActionView/utils';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed to fix a circular dependency

Comment on lines -16 to -28
export interface FolderData {
key: string;
id: string;
type: 'FOLDER';
}

export interface FileData {
key: string;
lastModified: Date;
id: string;
size: number;
type: 'FILE';
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to sibling types.ts

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interfaces in this file were migrated from ../types.ts to avoid potential circular references

@@ -8,6 +8,8 @@ export type TaskStatus =
| 'QUEUED'
| 'PENDING';

export type StatusCounts = Record<TaskStatus | 'TOTAL', number>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaces TasksCount

dbanksdesign
dbanksdesign previously approved these changes Nov 7, 2024
Comment on lines -394 to +408
type: 'RESET_LOCATION_ITEMS',
type: 'SET_LOCATION_ITEMS',
items: [fileDataOne, fileDataTwo],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was asserting the opposite behavior of the test description, same issue with the test case immediately below

Copy link
Contributor

@dindjarinjs dindjarinjs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still reviewing but publishing a few comments


export interface TaskHandlerInput<
T extends TaskData = TaskData,
K extends TaskHandlerOptions = TaskHandlerOptions,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Isn't K usually short for "Key"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally we have treated usage of K as a second positional generic name

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should maybe rethink this later. K is definitely a convention but we seem to be misusing it a bit

@calebpollman calebpollman merged commit 9dfd322 into feat-storage-browser/main Nov 7, 2024
34 checks passed
@calebpollman calebpollman deleted the feat/useUploadView branch November 7, 2024 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants