-
Notifications
You must be signed in to change notification settings - Fork 627
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: hydrate node with dangerouslySetInnerHTML #1957
Conversation
@@ -118,4 +118,18 @@ describe('Hydrate', () => { | |||
|
|||
expect(container.childNodes[0].childNodes[2].tagName).toBe('DIV'); | |||
}); | |||
|
|||
it('should not recolect hydration child with innerHtml', () => { |
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.
recolect 是不是拼错了
@@ -118,4 +118,18 @@ describe('Hydrate', () => { | |||
|
|||
expect(container.childNodes[0].childNodes[2].tagName).toBe('DIV'); | |||
}); | |||
|
|||
it('should not recolect hydration child with innerHtml', () => { |
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.
innerHtml -> innerHTML
@@ -429,6 +435,11 @@ export function beforeRender({ hydrate }) { | |||
} | |||
|
|||
function recolectHydrationChild(hydrationParent) { |
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.
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.
而且回忆,反思 也有点奇怪
逻辑上OK |
When hydrate node with dangerouslySetInnerHTML :
It will trigger
recolectHydrationChild
and clear innerHtml.Result is
<div class="container"></div>
rather than<div class="container" ><div>About Rax</div><div>Docs</div></div>