fix: resolve mutable default argument in getAddressesForFid - #555
Open
dajiaohuang wants to merge 5 commits into
Open
fix: resolve mutable default argument in getAddressesForFid#555dajiaohuang wants to merge 5 commits into
dajiaohuang wants to merge 5 commits into
Conversation
- Remove redundant else branch that was overwriting acc[type] with the same value - Fix mutable default argument by creating requestOptions object fresh each time - Properly merge user-provided hubRequestOptions with default api_key header
Create fresh requestOptions object each time to avoid shared mutable default. Properly merge user-provided hubRequestOptions with default api_key header.
Create fresh requestOptions object each time to avoid shared mutable default. Properly merge user-provided hubRequestOptions with default api_key header.
|
@dajiaohuang is attempting to deploy a commit to the Discove Team on Vercel. A member of the Team first needs to authorize it. |
| ...hubRequestOptions, | ||
| headers: { | ||
| ...(hubRequestOptions.headers ?? {}), | ||
| api_key: DEFAULT_HUB_API_KEY, |
Author
|
Addressed the current review feedback in the latest commit. The user-data reducer now stores the first value for each type and replaces it only when a newer timestamp is seen, so first-seen fields are no longer lost. Validation: git diff --check passed. The local checkout has no Yarn binary/dependencies, so the package test suite could not run here. |
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
修复
getAddressesForFid函数中的可变默认参数问题。问题
原代码使用了可变对象作为默认参数:
这个默认对象在所有调用中共享,如果调用者修改了它,会影响后续调用。
Fix