-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Optimizing getting cloud storage #3776
Conversation
9a55eb8
to
4235719
Compare
cvat-ui/src/reducers/interfaces.ts
Outdated
initialized: boolean; | ||
id: number | null; | ||
preview: string; | ||
error: string | null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you really need to store error in global state for CloudStoragePreview and CloudStorageStatus?
cvat-ui/src/reducers/interfaces.ts
Outdated
fetching: boolean; | ||
initialized: boolean; | ||
id: number | null; | ||
status: string | null; | ||
error: string | null; | ||
} | ||
|
||
export interface CloudStoragePreview { | ||
fetching: boolean; | ||
initialized: boolean; | ||
id: number | null; | ||
preview: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we reduce code duplication using typescript Pick
?
cvat-ui/src/reducers/interfaces.ts
Outdated
fetching: boolean; | ||
initialized: boolean; | ||
id: number | null; | ||
status: string | null; | ||
error: string | null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you think if it be like this:
[index: number]: {
fetching: boolean;
initialized: boolean;
id: number | null;
status: string | null;
error: string | null;
}
reducers and useSelectors callback would be easier?
cvat-ui/src/reducers/interfaces.ts
Outdated
preview: string; | ||
error: string | null; | ||
} | ||
type CloudStorageStatus = Pick<CloudStorageAdditional, 'fetching' | 'initialized' | 'id' | 'error' | 'status'>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need id
field here if it is a key now?
Motivation and context
Resolve #3759
How has this been tested?
Manually
Checklist
develop
branch- [ ] I have added tests to cover my changescvat-core, cvat-data and cvat-ui)
License
Feel free to contact the maintainers if that's a concern.