Closed nd0ut closed 1 month ago
The recent changes enhance the robustness and clarity of the upload management system. Key improvements include better type safety for activity parameters, streamlined error handling during activity transitions, and a more structured way of managing internal states across various classes. These modifications simplify the code while ensuring reliable functionality throughout the application.
File(s) | Change Summary |
---|---|
abstract/ActivityBlock.js |
Introduced ActivityParamsMap for type safety; modified control flow with error handling; refined type definitions for activities and parameters. |
abstract/CTX.js |
Removed '*focusedEntry' from uploaderBlockCtx , altering the context structure for uploads. |
abstract/UploaderBlock.js |
Changed storage of activity parameters to a new *currentActivityParams object for clarity. |
abstract/UploaderPublicApi.js |
Updated setCurrentActivity method to use generics for type safety in parameters based on activity type. |
blocks/CloudImageEditorActivity/CloudImageEditorActivity.js |
Added ActivityParams type; modified parameter handling and error management in the constructor and methods. |
blocks/ExternalSource/ExternalSource.js |
Introduced a new activityParams getter for validation of external source parameters. |
blocks/FileItem/FileItem.js |
Simplified the onEdit method by removing conditional logic, ensuring consistent activity setting. |
types/test/public-upload-api.test-d.tsx |
New test suite for verifying the UploadCtxProvider functionality, focusing on setCurrentActivity . |
types/test/uc-upload-ctx-provider.test-d.tsx |
Streamlined imports by removing duplicates and unnecessary references, improving code clarity. |
sequenceDiagram
participant User
participant UploaderPublicApi
participant ActivityBlock
participant CloudImageEditorActivity
User->>UploaderPublicApi: setCurrentActivity(activityType, params)
UploaderPublicApi->>ActivityBlock: validate params
ActivityBlock->>UploaderPublicApi: params validated
UploaderPublicApi->>CloudImageEditorActivity: initialize with params
CloudImageEditorActivity->>User: activity initialized successfully
π In the code, where once it was cluttered,
A clearer path now lies, unshuttered.
With types that guide and errors that fade,
The upload journey is sweetly laid!
Hooray for changes, letβs cheer and dance,
For now, our code has a brighter chance! π
@nd0ut good update!
Description
Checklist
Summary by CodeRabbit
New Features
ExternalSource
class.Bug Fixes
Refactor
onEdit
method of theFileItem
class.