refactor(storage): convert storageUrl to named args#9833
Closed
Light2Dark wants to merge 1 commit into
Closed
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
No issues found across 2 files
Architecture diagram
sequenceDiagram
participant Caller as Storage URL Caller
participant types as types.ts
participant URL as URL Constructor
Note over Caller,URL: CHANGED: storageUrl now uses named params object
Caller->>types: storageUrl({ protocol, rootPath, entryPath })
types->>types: Destructure named args
types->>types: Filter rootPath and entryPath by truthiness
types->>types: Join filtered paths with "/"
types->>types: Collapse multiple slashes via replaceAll
types->>URL: new URL(`${protocol}://${joinedPath}`)
URL-->>types: Return constructed URL
types-->>Caller: Return URL object
Note over Caller: Call sites now pass object literal<br/>instead of positional args
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the storageUrl helper in the frontend storage layer to take a single named-arguments object rather than positional parameters, aiming to improve readability and make argument ordering explicit.
Changes:
- Updated
storageUrlsignature infrontend/src/core/storage/types.tsto accept a destructured object with{ protocol, rootPath, entryPath }. - Updated unit tests to call
storageUrlwith named arguments.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| frontend/src/core/storage/types.ts | Refactors storageUrl to accept a named-args object. |
| frontend/src/core/storage/tests/types.test.ts | Updates tests to match the new storageUrl call signature. |
Comment on lines
+35
to
+43
| export function storageUrl({ | ||
| protocol, | ||
| rootPath, | ||
| entryPath, | ||
| }: { | ||
| protocol: string; | ||
| rootPath: string; | ||
| entryPath: string; | ||
| }): URL { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Summary
Split out from #9708.
Pure refactor: converts
storageUrl(protocol, rootPath, entryPath)to a single named-args object to improve readability at call sites. Satisfies typechecker.📋 Pre-Review Checklist
✅ Merge Checklist