#Interval emitting after unsubscribing with takeUntil
13 messages · Page 1 of 1 (latest)
What happens one extra time? Your grid assigning? If yes, you should try to split the grid assigning + checkFor… in two different taps
Btw assigning/reassigning an external value within a stream is a bad practice, you should try to find another way to proceed (Like making a grid$ stream with a map instead of that tap with assigning)! You may not see any issue doing that and it may work, but sooner or later you will find out that it is not a good thing to do.
I moved chekFor... in another tap but i get the same issue. After game$ emits tick$ should end i think but instead it emits one more time so snake gets out of border.
It looks like takeUntil was working just fine and the issue was where i was updating snake...
Yeah that’s a timing issue. It happens quite often when you do some imperative code with observables
Could you fix it?
Yes it is!
First of all, declarative is more "complete" thanks to reactive programming + the gain in term of readability is huge! You won't fear CTRL CLICKs on some variable used 4572 times in many files
Thank you