-
Notifications
You must be signed in to change notification settings - Fork 21
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: ensure undefined parameters not added to URL #286
Conversation
Tests
Bug Fixes
ContributorsCommit-Lint commandsYou can trigger Commit-Lint actions by commenting on this PR:
|
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 my context, would you mind explaining what the motivation for this PR is? In isolation, it seems fine but I'm hesitant to add guardrails for scenarios that don't sound likely to happen?
That is, unless this is proactively guarding against something that we know is happening, such as in a consuming library.
@sherwinski there was a bug occurring in Gatsby that was caused by this. Basically, we had some code like this: const imgixParams = {
...args.imgixParams,
ar: (width != null && height != null) ? `${width/height}:1` : undefined
};
const src = client.buildURL(path, imgixParams); // => contains ar=undefined You can see I think this is pretty common not only to have It's a pretty common pattern that if an object value is |
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.
✅
@frederickfogerty I guessed as much, but figured I ask anyways 😁 |
Co-authored-by: Frederick Fogerty <[email protected]>
This commit ensures that undefined parameters are not added to the params object generated by _buildParams. This way, undefined params do not then end up in the generated URL. Co-authored-by: Frederick Fogerty <[email protected]>
4ac86e7
to
f7fc708
Compare
This PR ensures that undefined parameters are not added to the
params object generated by _buildParams. This way, undefined params do
not then end up in the generated URL.