-
Notifications
You must be signed in to change notification settings - Fork 17
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: Update useStyledComponentsTarget to support case where head tag is removed. #414
base: develop
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for chat-ai-widget ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Size Change: +171 B (+0.03%) Total Size: 618 kB
ℹ️ View Unchanged
|
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.
lgtm!
console.warn('[useStyledComponentsTarget]: Styled Components styles re-injected, switching to <body>'); | ||
setTarget(document.body); | ||
} else if (node instanceof HTMLElement && node.id === StyledId) { | ||
moveStyleToBody(node); |
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.
nit: 요거 added 케이스는 제거가 되어도 될거같아요
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.
오 넵 헤드에 추가됐을 때 바디로 옮기는 로직이었네요. 있으면 안될 로직이네요. 완료했습니다.
const moveStyleToBody = (styleElement: HTMLElement) => { | ||
if (styleElement && styleElement.parentElement !== document.body) { | ||
console.warn(`[useStyledComponentsTarget]: Moving style element ${StyledId} to <body>.`); | ||
document.body.appendChild(styleElement); |
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.
요거는 제거된 케이스에서만, body 대신 head 위치에 다시 추가하면 좋을 것 같습니다!
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.
제거된 케이스가 Head 에서 제거된 케이스로 이해했는데 그렇다면 head 에 추가할 수 없지 않을까요? 그래서 body 에 추가하도록 구현했어요.
@bang9 changelog 는 1.9.4 에 나간 그데로 적어놓긴 했는데, 다른 좋은 아이디어 있으실까요? |
Changes
ticket: AA-772
Additional Notes
Checklist
Before requesting a code review, please check the following: