I’m not sure exactly what you’re expecting to happen, so I can only speak in generalities.
Anything you write in a lifecycle event handler should perfectly fine with being executed only once, or many times. The only thing you should rely on is that with paired ones (such as ngOnInit
/ ngOnDestroy
), they’ll be paired. You won’t get two calls to ngOnInit
without an intervening ngOnDestroy
.
So, if you’re going to wire up sources of data in ngOnInit
, they have to be capable of responding to changes if that can happen. Sometimes you don’t care about this. This is apparently not one of those times. So, as I see it you have two choices: move what is in ngOnInit
now out of it, or don’t use snapshots in there - subscribe to long-lived Observable
s instead, as described in here.