-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(cdk/table): support hydration #28356
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
Conversation
} | ||
|
||
/** Renders the table if its state has changed. */ | ||
private _render(): void { |
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.
This is a big diff, but I basically just moved the code from ngAfterContentChecked
into a separate method.
9b72bb3
to
ed8e3c0
Compare
Reworks the table so that it can support hydration. There were a few issues that broke hydration: 1. There wasn't a catch-all `ng-content` slot which meant that the comment nodes representing the table content were dropped, causing an error. 2. The table needs to conditionally wrap some content with native table sections (`thead`, `tbody` etc.) which was done with direct DOM manipulation. This breaks hydration because Angular won't know about those elements. The first issue is easily resolved by adding an `ng-content` element. It shouldn't affect existing tables, since all the projected content is composed of comment nodes. The second issue is a bit trickier, because we were using content queries to resolve the individual table outlets. Wrapping them in a conditional breaks the query so we have to use something else to resolve them. I've worked around it by using DI which doesn't have the exact same timing, but it appears to be close enough. Fixes angular#28355.
ed8e3c0
to
3035d33
Compare
Fixes that after angular#28356 the table rows were measured too early which caused multiple sticky rows not to work as expected.
Fixes that after angular#28356 the table rows were measured too early which caused multiple sticky rows not to work as expected.
Fixes that after #28356 the table rows were measured too early which caused multiple sticky rows not to work as expected.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Reworks the table so that it can support hydration. There were a few issues that broke hydration:
ng-content
slot which meant that the comment nodes representing the table content were dropped, causing an error.thead
,tbody
etc.) which was done with direct DOM manipulation. This breaks hydration because Angular won't know about those elements.The first issue is easily resolved by adding an
ng-content
element. It shouldn't affect existing tables, since all the projected content is composed of comment nodes.The second issue is a bit trickier, because we were using content queries to resolve the individual table outlets. Wrapping them in a conditional breaks the query so we have to use something else to resolve them. I've worked around it by using DI which doesn't have the exact same timing, but it appears to be close enough.
Fixes #28355.