Samuel
re: back button bug - I enabled react-navigation redux dev tools integration but nothing seems out of the ordinary so far
1 6
dan
you probably wanna place a breakpoint wherever it does goBack() and examine why it decides to do so with nothing on the in-app history stack. maybe it reads some stale variable
1 6
dan
fwiw i found it structured pretty well. but id maybe start at the opposite end and override history.back and history.go with { debugger } and work backwards
1 6
Samuel
@samuel.fm
ok narrowed it down to here. it tries to catch pushes that go beyond the history state, but fails to do (n is -3 when the stack is only 2 items long)
1 2 6
Samuel
aha - createMemoryHistory thinks there are 4 items in the stack, because it's counting /notifications twice. whereas the browser (and interestingly the devtools) correctly thinks there are 3
1 8
Samuel
ok when the back button is intercepted, it finds the matching state in the history and resets to that point. however, seems like it pushes an item to memoryHistory rather than resetting to it. now to find out how resetRoot works
1 8
Samuel
ok it just dispatches an event, very simple. so I need to see how it circles back to memoryHistory
1 6
Samuel
ah ok so it's calling history.replace, making on back button press it goes from / /notifications /profile/etc/post/etc to / /notifications /notifications
1 4
Samuel
Hmm this is an interesting bug. Handling browser navigation is basically just a guess as to where in the history it lands, so keeping the internal history and browser history synced is really hard. I wonder how react-router handles this
1 4