-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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(table): schematic generates code that throws an exception #15800
Conversation
@andrewseguin PTAL |
Any fixes? The problem is still relevant. |
@Splaktar can you rebase? @andrewseguin can you review? |
fix exception when instantiating MatPaginator before dataSource defined fix ExpressionChangedAfterItHasBeenCheckedError caused by above - first initialize the template w/o dataSource & w/ a sort and paginator - then get the references to the template's MatSort and MatPaginator - then set the data source's sort and paginator - then set the table's data source from the component Fixes #15788
1596160
to
dd7f4ea
Compare
Rebased ✅ |
It seems it would be easier to just add I'm not a fan of providing the data source as an input to the table in the code rather than the template, and the data source code in general is confusing because it tries to be a mix of client-side and server-side data. Also, this is particular is confusing to read and doesn't seem to be the best way to show users how to use the datasource: return merge(...dataMutations).pipe(map(() => {
return this.getPagedData(this.getSortedData([...this.data]));
})); |
@andrewseguin I tried to explain it a bit in the commit, but it may be too brief. I had discussed this a good deal with Paul while working on it. Just making the |
Yeah, people should extremely rarely call |
@andrewseguin I agree that the snippet of RxJS that you posted is not an easily readable piece of code as it uses a lot of concepts that may not be well known by every developer. However, that wasn't introduced or changed in this PR. I had considered doing so, but I didn't want to widen the scope of the PR, so I tried my best to keep that intact. |
@andrewseguin on the topic of client vs server side paging, I agree that this is confusing to developers who just want to try out our schematic and may only be considering one of those options. I commented in #15791 (comment) that we should probably have an option to generate the table with client or server side paging. I also mentioned that we should probably have an option to generate a table w/o paging or sorting. Should I open issues to track that? |
What about just removing |
@andrewseguin if I make only those changes, then the original error from #15788 remains: Line 60 in dd7f4ea
When the |
Hm, well hopefully we could figure out some better syntax to the whole schematics. For now this looks fine if the other solutions aren't panning out |
…r#15800) fix exception when instantiating MatPaginator before dataSource defined fix ExpressionChangedAfterItHasBeenCheckedError caused by above - first initialize the template w/o dataSource & w/ a sort and paginator - then get the references to the template's MatSort and MatPaginator - then set the data source's sort and paginator - then set the table's data source from the component Fixes angular#15788
How to find out which version contains this fix? |
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. |
fix exception when instantiating
MatPaginator
beforedataSource
definedfix
ExpressionChangedAfterItHasBeenCheckedError
caused by abovedataSource
& w/ a sort and paginatorMatSort
andMatPaginator
Fixes #15788
Not the same issue, but this is also related to #15791.