78 likes
·
8.5K reads
5 comments
This is brilliantly put together. Thank you for sharing Alexey Karpov!
Nice work but I have a question about the facade layer as you mentioned you subscribe to your subject in order to make sure that fresh data is available inside the subject but what about destroying that subscription doesn't it create a memory leak because whenever we call the facade method it will create a subscription and that subscription will always be on the memory how to handle this case?
Hi, I’m sorry for the very late answer. That’s a good question. In general case such subscription should be treated with extra care, e.g. we always need to precisely know when to unsubscribe. In this case I have an observable that emits only 1 value, when HTTP request is done. Essentially this facade says “no matter what, the request shouldn’t be cancelled”. I don’t apply this same solutions to all the components and facades. Whenever it’s possible, I subscribe as close to the data rendering as possible, ideally in the HTML template.
Impacting. Do you have any work on the full implementation of todos, it's dos and don'ts in react?
cool piece.