fix: resolve hubRequestOptions being overwritten in getFrameMessage - #557
Open
dajiaohuang wants to merge 7 commits into
Open
fix: resolve hubRequestOptions being overwritten in getFrameMessage#557dajiaohuang wants to merge 7 commits into
dajiaohuang wants to merge 7 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.
- Fix mutable default argument by using empty object as default - Add missing api_key header when using default hub URL
When using the default hub URL, user-provided hubRequestOptions (like cache, credentials, etc.) were being completely lost. Now properly merges user options with the 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. |
Comment on lines
+27
to
+33
| const requestOptions = { | ||
| ...hubRequestOptions, | ||
| headers: { | ||
| ...(hubRequestOptions.headers ?? {}), | ||
| api_key: DEFAULT_HUB_API_KEY, | ||
| }, | ||
| }; |
Comment on lines
+37
to
+43
| const requestOptions = { | ||
| ...hubRequestOptions, | ||
| headers: { | ||
| ...(hubRequestOptions.headers ?? {}), | ||
| api_key: DEFAULT_HUB_API_KEY, | ||
| }, | ||
| }; |
Comment on lines
53
to
+54
| ...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
修复
getFrameMessage函数中hubRequestOptions被覆盖的问题。问题
当使用默认 hub URL (
DEFAULT_HUB_API_URL) 时,用户提供的hubRequestOptions(如cache、credentials等)完全丢失,因为代码直接用一个只包含api_key的对象覆盖了整个选项。代码变更
Fix
现在正确合并用户提供的选项与默认的
api_keyheader。