-
Notifications
You must be signed in to change notification settings - Fork 100
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
fix: a "complete" URLObject in target
should be left as it is
#529
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -47,6 +47,14 @@ function isValidButtonAction(action: unknown): action is ButtonActions { | |||
return typeof action === "string" && action in buttonActionToCode; | |||
} | |||
|
|||
function isUrlObjectComplete(urlObject: UrlObject): boolean { | |||
return ( |
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.
You should also check if the values are set right? URLObject is just saying that there are properties but their values can be empty right?
Also wouldn't it make sense to also allow URL class instance?
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.
Tha last point about URL instance is for generateTargetUrl function. baseUrl is typed like that.
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.
URLObject
is already compatible with URL
, the user is able to pass an URL
object. Also to add URL
explicitly the whole call stacks will be updated. as it is gaining nothing I think let's leave that part out?
I've updated value check into isUrlObjectComplete
, pls have a look @michalkvasnicak , thanks!
Change Summary
This PR avoids pathname overwriting when passing in an URLObject with all necessary props to
generateTargetURL()
.If the user passing in a URL object with all props required to construct a full URL, that means they want to go straight to there without modification. But current behaviour of
generateTargetURL()
overwrite itspathname
by prepending thepathname
ofbaseUrl
Merge Checklist