Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I get stack trace of an action? #419

Closed
arximughal opened this issue Dec 13, 2018 · 3 comments
Closed

How do I get stack trace of an action? #419

arximughal opened this issue Dec 13, 2018 · 3 comments

Comments

@arximughal
Copy link

I am debugging a react-native application and there's an action that I can't, for the life of me, figure out where is being dispatched from?

As this is the first time I am using redux-devtools, so I am not sure if the dispatched actions have a stack trace as well? If yes, where do I check that?

If not, any tips on how do I debug this one?

<NULL>

Here's the component that's dispatching FINISH_INTERVENTION:

import React from 'react'
import { View, Text, ImageBackground } from 'react-native'
import Style from './InterventionCompleteScreenStyle'
import { connect } from 'react-redux'
import { isLoggedIn, submittingAnswers, answersSubmittedSuccessfully, answersSubmissionError } from '../../Stores/ARC/Selectors'
import ARCActions from 'App/Stores/ARC/Actions'
import Images from 'App/Theme/Images'

class InterventionCompleteScreen extends React.Component {
	constructor(props) {
		super(props)
	}

	componentDidMount() {
		let answers = null
		let type = null
		let startDate = null
		if (this.props.navigation !== null) {
			if (this.props.navigation.getParam('answers')) {
				answers = this.props.navigation.getParam('answers')
			} else {
				answers = []
			}
			if (this.props.navigation.getParam('startDate')) {
				startDate = this.props.navigation.getParam('startDate')
			}
			if (this.props.navigation.getParam('interventionType')) {
				type = this.props.navigation.getParam('interventionType')
			}
		}
		this.props.finishIntervention()
		console.log('calling submitaswers')
		this.props.submitAnswers(answers, this.props.authToken, type, startDate)
	}

	render() {
		return (
			<View style={Style.container}>
				<ImageBackground
					source={Images.messagesBg}
					resizeMode="cover"
					style={Style.mainBg}
				>
					<View style={Style.mainContentContainer}>
						<View style={Style.contentContainer}>

						</View>
					</View>
				</ImageBackground>
			</View>
		)
	}
}

const mapStateToProps = (state) => ({
	authToken: isLoggedIn(state),
	answersSubmissionError: answersSubmissionError(state),
	answersSubmittedSuccessfully: answersSubmittedSuccessfully(state),
	submittingAnswers: submittingAnswers(state),
})

const mapDispatchToProps = (dispatch) => ({
	submitAnswers: (answers, authToken, type, timestamp) => dispatch(ARCActions.submitAnswers(answers, authToken, type, timestamp)),
	finishIntervention: () => dispatch(ARCActions.finishIntervention()),
})

export default connect(
	mapStateToProps,
	mapDispatchToProps
)(InterventionCompleteScreen)
@arximughal
Copy link
Author

Never mind the whole question, I figured out my mistake after 3 hours.
But I'd still love to know how to check the stack trace of the dispatched action or even there's anything like that in redux-devtools?
Any other package, that would integrates well with redux-devtools for this purpose would be nice to look at as well. 🙂

@zalmoxisus
Copy link
Collaborator

Yes, there's work in progress in #418 and an open issue in zalmoxisus/redux-devtools-extension#429. Hope to get it in the extension next days.

@arximughal
Copy link
Author

That's really great. Excited to see it 😍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants