Transcript from the "NgRx Q&A" Lesson
>> Speaker 1: How can we check the size of the state tree? Do we ever need to clean the state tree? Are you worried about how big the storage gets?
>> Lukas Ruebbelke: It's never been a problem for me. I would say, I'd be worried about state if it wasn't in the state tree.
[00:00:21] And so, by condensing it and consolidating into a single place, I've actually found that my applications have become far more performing. There maybe a case where you're loading in 10,000 objects. And so there is a possibility you may have just a ridiculous amount of state. I would say that's probably a UX problem at that point.
[00:00:45] So if you have 10,000 things in your application store, how could somebody possibly have a meaningful interaction with that? The other thing is, because you're doing immutable operations, is that it's actually far more performant on memory. Cuz you're actually just creating new pointers and not trying to do this change or did this not?
>> Speaker 1: The other two questions are on setting initial state. Can we fetch the projects in ngOnInit instead of the constructor? And would it work any differently?
>> Lukas Ruebbelke: So you can. So typically, I try to avoid doing any complex construction logic in the constructor. So any kind of setup logic.
[00:01:35] Because when this is initialized, that the store has already been initialized ahead of that. It's typically not a problem, but you definitely could move it to ngOnInit. This right here, I will also say that we're going to be refactoring this kind of selector in here, so it's a lot cleaner.
[00:01:59] Because if I saw this in the constructor, I was like, that's not good. But once you actually clean that up and you're not doing that, it doesn't offend me as much. Because I know for a fact that the store already exists and it is initialized. But you could do that in ngOnInit and it wont be a problem