82 likes
·
12.1K reads
6 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.
This article was very helpful for me, of course I am new to this field and need to spend more time learning and experiencing to be able to give a better opinion and along the way I hope to use your knowledge.
Impacting. Do you have any work on the full implementation of todos, it's dos and don'ts in react?
cool piece.