-
Notifications
You must be signed in to change notification settings - Fork 0
[Feature] 온보딩 초대코드 자동입력 기능 추가 #152
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| export const getQueryParam = ( | ||
| key: string, | ||
| search: string = window.location.search | ||
| ): string | undefined => { | ||
| const value = new URLSearchParams(search).get(key); | ||
|
|
||
| if (!value) { | ||
| return undefined; | ||
| } | ||
|
|
||
| return value; | ||
| }; | ||
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
Oops, something went wrong.
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.
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.
새로 추가된
getQueryParam유틸리티 함수의 안정성과 명확성을 높이기 위한 개선 제안입니다.window객체 접근 시점: 함수 시그니처의 기본값으로window.location.search를 사용하면, 코드가 서버사이드 렌더링(SSR) 등 브라우저가 아닌 환경에서 실행될 때window객체가 없어 에러가 발생할 수 있습니다.window객체는 함수가 호출되는 시점에, 즉 함수 본문 내에서 접근하는 것이 더 안전합니다.값 부재 시 처리 로직:
URLSearchParams.get()메서드는 파라미터가 없을 경우null을 반환합니다. 현재!value조건문은null뿐만 아니라 값이 비어있는 파라미터(?key=)가 전달될 때의 결과인 빈 문자열('')까지undefined로 처리하여, 의도치 않은 동작을 유발할 수 있습니다.null일 경우에만undefined를 반환하도록 명확히 하는 것이 좋습니다.아래 제안 코드는 이 두 가지를 모두 개선합니다.