Closed blainekasten closed 1 year ago
Our application runs a lot of async logic on app start before rendering the routing tree. During this time we had a utility function to wrap the router.back API in which we did the following:
router.back
const useNavigation = () => { const router = useRouter(); return { navigate: router.push, back: router.canGoBack() ? router.back : () => router.push('/') }; }
Unexpectedly, the function call to canGoBack() was throwing an assertion about trying to navigate without the navigation context.
canGoBack()
I changed the code via the github UI with zero testing or validation. 🙃
Please advise how I can best support and test this
Motivation
Our application runs a lot of async logic on app start before rendering the routing tree. During this time we had a utility function to wrap the
router.back
API in which we did the following:Unexpectedly, the function call to
canGoBack()
was throwing an assertion about trying to navigate without the navigation context.Execution
I changed the code via the github UI with zero testing or validation. 🙃
Test Plan
Please advise how I can best support and test this