-
Notifications
You must be signed in to change notification settings - Fork 14
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
refactor(utils): Remove unused download progress handling. #176
Conversation
WalkthroughThis update modifies two modules. In the LogFileManager utility, the Changes
Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/utils/http.ts (2)
38-54
: LGTM! Consider adding parameter type to JSDoc.The function is well-implemented and handles edge cases appropriately. Consider adding the
ProgressCallback
type to the@param
JSDoc for better documentation./** * Normalizes the total size of a download event, and calls the provided onProgress callback with * loaded and total sizes. * - * @param onProgress + * @param {ProgressCallback} onProgress The progress callback to wrap * @return The handler that wraps `onProgress`. */
56-73
: Update JSDoc to reflect optional parameter.The changes look good, but the JSDoc should be updated to indicate that
onProgress
is optional./** * Downloads (bypassing any caching) a file as a Uint8Array. * * @param fileUrl - * @param [onProgress] + * @param {ProgressCallback} [onProgress] Optional callback to track download progress * @return The file's content. * @throws {Error} if the download fails. */
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/services/LogFileManager/utils.ts
(1 hunks)src/utils/http.ts
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{cpp,hpp,java,js,jsx,ts,tsx}`: - Prefer `false ==
**/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
src/utils/http.ts
src/services/LogFileManager/utils.ts
**/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
src/utils/http.ts
src/services/LogFileManager/utils.ts
🔇 Additional comments (2)
src/utils/http.ts (1)
1-4
: LGTM!The addition of
AxiosProgressEvent
type import is necessary for the new progress handling functionality.src/services/LogFileManager/utils.ts (1)
142-142
: LGTM!The removal of the progress callback is appropriate since the function doesn't need to track progress when loading from a string source, and
getUint8ArrayFrom
now has a default value foronProgress
.
src/utils/http.ts
Outdated
loaded, | ||
total, | ||
}: AxiosProgressEvent) => { | ||
if ("undefined" === typeof total || isNaN(total)) { |
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.
Note we also added the isNan(total)
check here. The NaN
value was discovered through new unit tests (to be reviewed at #177 )
src/utils/http.ts
Outdated
const getUint8ArrayFrom = async (fileUrl: string, progressCallback: ProgressCallback) | ||
const getUint8ArrayFrom = async ( | ||
fileUrl: string, | ||
onProgress: ProgressCallback = () => 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.
Note now we provide a default value to onProgress
if it's not provided by the caller.
I looked briefly at the changes. Does the old code have a purpose? LIke I am happy to approve this change, but perhaps we can just delete this callback feature entirely? Also what is this PR for, is it related to the unit test you are adding? |
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.
See earlier comment
right, the old callback
Partially, it includes a bug fix at https://github.com/y-scope/yscope-log-viewer/pull/176/files#r1946668560 . Most importantly, that we are refining the onProgress callback and making it optional will allow us to align the interface of another utility |
After looking at the latest change, I now worry that now the logs will clutter the console making debugging more difficult. In addition, after thinking about more about UI feature, it is quite complicated to pass this data to the front-end, so I not sure we will have bandwidth to add this soon. Also the function For these reasons, I still think we should just remove onDownloadProgress from the axios request. I think it will also make reviewing the unit test PR faster. |
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.
for title refactor(utils): Remove unused download progress handling.
Description
Checklist
breaking change.
Validation performed
filePath=https://yscope.s3.us-east-2.amazonaws.com/sample-logs/yarn-ubuntu-resourcemanager-ip-172-31-17-135.log.1.clp.zst
in the application URL.Summary by CodeRabbit
Summary by CodeRabbit
New Features
• Enhanced file data loading process for improved performance.
Refactor
• Simplified the interface for file downloading by removing unnecessary progress reporting.
• Streamlined file data handling processes for a smoother experience when accessing files.
• Updated method signatures for clarity and improved usability.