-
Notifications
You must be signed in to change notification settings - Fork 52
Fix bug that first StackItem has marginBefore when preceding node is not JSX.Element
#1120
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 bug that first StackItem has marginBefore when preceding node is not JSX.Element
#1120
Conversation
🦋 Changeset detectedLatest commit: e67d172 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov ReportBase: 72.75% // Head: 72.77% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## next-v1 #1120 +/- ##
===========================================
+ Coverage 72.75% 72.77% +0.01%
===========================================
Files 362 362
Lines 4371 4374 +3
Branches 852 853 +1
===========================================
+ Hits 3180 3183 +3
Misses 1117 1117
Partials 74 74
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Chromatic Report🚀 Congratulations! Your build was successful! |
sungik-choi
left a comment
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.
Stack이 매우 많아지면 런타임 오버헤드도 무시 못할 수준일 거 같아 flex gap을 사용하는 버전도 만들어서 테스트해봐야겠네요
8e64940 to
e67d172
Compare
연산량이 그렇게 늘어날 것 같지는 않지만 flex gap 으로 하면 다소 불필요한 |
넵 이렇게 바꾼다면 |
Self Checklist
[Component] I wrote a storybook document about the implementation.[Component] I tested the implementation in various browsers.CODEOWNERSfile.Related Issue
Fixes #1116
Summary
StackItem이 원하지 않는marginBefore를 갖는 버그를 수정합니다.Details
ReactElement. 참고로string,boolean,null등은ReactElement가 아닌ReactNode입니다) 라면index > 0만 검사하였기 때문에 아래와 같은 상황에서 원치 않은marginBefore가 들어갔습니다.marginBefore를 줍니다.React.Children.toArray(children).findIndex(...)과 같이children을 미리 검사하는 방법으로 첫번째 valid한 element 의 index 를 찾으려고 했으나,toArray자체가 valid 한 element 만 filter 하기 때문에 사용하지 못했습니다. 따라서useRef를 사용하여 로직을 만들었습니다.Breaking change or not (Yes/No)
References
ReactElement vs ReactNodeStackto give spacing properly to itsStackItemchildren #1116