Updating router before state is set and components are updated