Redux Thunk + ReactJS: Action creator being called but dispatch function not being called
I'm encountering a rather strange problem with my ReactJS x Redux app that I've never seen before and am having a hard time figuring out.
In my ReactJS component I'm wiring up an action creator function that's using redux-thunk
to make async calls before dispatching to a reducer using the connect()
function from react-redux
+ the object mapDispatchToProps
notation. It looks like this:
const mapStateToProps = (state) => ({
...state.single_pano
});
const mapDispatchToProps = {
loadPano
};
export default connect(mapStateToProps, mapDispatchToProps)(PanoView);
For the sake of simplicity, let's say the loadPano
action creator looks something like this:
export const loadPano = (id) => {
console.log('Action creator called.');
return async (dispatch) => {
console.log('Dispatch function called.');
const doc = await db.doc('/path/to/doc/'+id).get();
dispatch({
type: 'LOAD_ACTION',
payload: doc
});
}
}
Here's where things get weird:
In my componentDidMount()
lifecycle function, I'm making a call to this.props.loadPano(panoID)
which works exactly as expected (both console.log()
calls in the action creator are invoked, the async
/await
returns and the action is dispatched to the reducer).
Later, I need to call this.props.loadPano(panoID)
again in the component's componentWillReceiveProps()
lifecycle function because a URL parameter is changed, and some data needs to be fetched and reloaded. HOWEVER, what ends up happening this time is the action creator (loadPano
) is called, but the redux-thunk
dispatch function (return (dispatch) => { ... }
) never gets called. I can tell this is the case because the first console.log()
is called, but the second one never is never logged to the console.
Other things slighty out of the ordinary that I'm doing that might be related, but so far I've been unable to confirm any of it:
- The
PanoView
component makes use ofshouldComponentUpdate()
lifecycle method to control when the DOM is rendered. - I'm being a little hacky / not best practice-y using a variable outside of the
PanoView
component's state to store an 3rd party library object that modifies the DOM directly via a DOMref
, and can't really be used properly in conjunction with ReactJS. However I believe this to be isolated, and can't see how it would be interfering with Redux / Thunk. Especially because the dispatch function fires correctly the first time.
Relevant dependencies + versions (installed via yarn
):
"firebase": "^5.2.0",
"photo-sphere-viewer": "^3.4.0",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-redux": "^5.0.7",
"react-router-dom": "^4.3.1",
"redux": "^4.0.0",
"redux-thunk": "^2.3.0"
Requested updates:
My componentWillReceiveProps
lifecylce function for the PanoView
component looks as follows:
componentWillReceiveProps(newProps) {
// Pano received
const oldPanoID = this.props.match.params.panoID;
const newPanoID = newProps.match.params.panoID;
if (oldPanoID !== newPanoID) {
loadPano(newPanoID);
}
}
javascript reactjs redux react-redux
add a comment |
I'm encountering a rather strange problem with my ReactJS x Redux app that I've never seen before and am having a hard time figuring out.
In my ReactJS component I'm wiring up an action creator function that's using redux-thunk
to make async calls before dispatching to a reducer using the connect()
function from react-redux
+ the object mapDispatchToProps
notation. It looks like this:
const mapStateToProps = (state) => ({
...state.single_pano
});
const mapDispatchToProps = {
loadPano
};
export default connect(mapStateToProps, mapDispatchToProps)(PanoView);
For the sake of simplicity, let's say the loadPano
action creator looks something like this:
export const loadPano = (id) => {
console.log('Action creator called.');
return async (dispatch) => {
console.log('Dispatch function called.');
const doc = await db.doc('/path/to/doc/'+id).get();
dispatch({
type: 'LOAD_ACTION',
payload: doc
});
}
}
Here's where things get weird:
In my componentDidMount()
lifecycle function, I'm making a call to this.props.loadPano(panoID)
which works exactly as expected (both console.log()
calls in the action creator are invoked, the async
/await
returns and the action is dispatched to the reducer).
Later, I need to call this.props.loadPano(panoID)
again in the component's componentWillReceiveProps()
lifecycle function because a URL parameter is changed, and some data needs to be fetched and reloaded. HOWEVER, what ends up happening this time is the action creator (loadPano
) is called, but the redux-thunk
dispatch function (return (dispatch) => { ... }
) never gets called. I can tell this is the case because the first console.log()
is called, but the second one never is never logged to the console.
Other things slighty out of the ordinary that I'm doing that might be related, but so far I've been unable to confirm any of it:
- The
PanoView
component makes use ofshouldComponentUpdate()
lifecycle method to control when the DOM is rendered. - I'm being a little hacky / not best practice-y using a variable outside of the
PanoView
component's state to store an 3rd party library object that modifies the DOM directly via a DOMref
, and can't really be used properly in conjunction with ReactJS. However I believe this to be isolated, and can't see how it would be interfering with Redux / Thunk. Especially because the dispatch function fires correctly the first time.
Relevant dependencies + versions (installed via yarn
):
"firebase": "^5.2.0",
"photo-sphere-viewer": "^3.4.0",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-redux": "^5.0.7",
"react-router-dom": "^4.3.1",
"redux": "^4.0.0",
"redux-thunk": "^2.3.0"
Requested updates:
My componentWillReceiveProps
lifecylce function for the PanoView
component looks as follows:
componentWillReceiveProps(newProps) {
// Pano received
const oldPanoID = this.props.match.params.panoID;
const newPanoID = newProps.match.params.panoID;
if (oldPanoID !== newPanoID) {
loadPano(newPanoID);
}
}
javascript reactjs redux react-redux
Can you show where you're passing dispatch?
– Colin
Nov 18 '18 at 12:18
@Colin Not sure I understand, I'm using the object notation formapDispatchToProps
+react-redux
'sconnect()
to wire up the action creator to the component's props, then in the action creator I'm returning a function (utilizingredux-thunk
) that callsdispatch
after theawait
/ promise returns. I believeredux-thunk
is responsible for passing indispatch
.
– saricden
Nov 18 '18 at 12:42
Could you please share a link to github repo?
– Michal
Nov 20 '18 at 15:05
1
Uh currently it's hosted on a private Bitbucket repo... I've been meaning to move it to GH, but haven't gotten around to it yet.
– saricden
Nov 20 '18 at 15:11
1
@Michal I'll make it a priority tomorrow after I finish work. Should be able to get it up by EOD tomorrow (I'm on Korean Standard Time).
– saricden
Nov 20 '18 at 15:12
add a comment |
I'm encountering a rather strange problem with my ReactJS x Redux app that I've never seen before and am having a hard time figuring out.
In my ReactJS component I'm wiring up an action creator function that's using redux-thunk
to make async calls before dispatching to a reducer using the connect()
function from react-redux
+ the object mapDispatchToProps
notation. It looks like this:
const mapStateToProps = (state) => ({
...state.single_pano
});
const mapDispatchToProps = {
loadPano
};
export default connect(mapStateToProps, mapDispatchToProps)(PanoView);
For the sake of simplicity, let's say the loadPano
action creator looks something like this:
export const loadPano = (id) => {
console.log('Action creator called.');
return async (dispatch) => {
console.log('Dispatch function called.');
const doc = await db.doc('/path/to/doc/'+id).get();
dispatch({
type: 'LOAD_ACTION',
payload: doc
});
}
}
Here's where things get weird:
In my componentDidMount()
lifecycle function, I'm making a call to this.props.loadPano(panoID)
which works exactly as expected (both console.log()
calls in the action creator are invoked, the async
/await
returns and the action is dispatched to the reducer).
Later, I need to call this.props.loadPano(panoID)
again in the component's componentWillReceiveProps()
lifecycle function because a URL parameter is changed, and some data needs to be fetched and reloaded. HOWEVER, what ends up happening this time is the action creator (loadPano
) is called, but the redux-thunk
dispatch function (return (dispatch) => { ... }
) never gets called. I can tell this is the case because the first console.log()
is called, but the second one never is never logged to the console.
Other things slighty out of the ordinary that I'm doing that might be related, but so far I've been unable to confirm any of it:
- The
PanoView
component makes use ofshouldComponentUpdate()
lifecycle method to control when the DOM is rendered. - I'm being a little hacky / not best practice-y using a variable outside of the
PanoView
component's state to store an 3rd party library object that modifies the DOM directly via a DOMref
, and can't really be used properly in conjunction with ReactJS. However I believe this to be isolated, and can't see how it would be interfering with Redux / Thunk. Especially because the dispatch function fires correctly the first time.
Relevant dependencies + versions (installed via yarn
):
"firebase": "^5.2.0",
"photo-sphere-viewer": "^3.4.0",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-redux": "^5.0.7",
"react-router-dom": "^4.3.1",
"redux": "^4.0.0",
"redux-thunk": "^2.3.0"
Requested updates:
My componentWillReceiveProps
lifecylce function for the PanoView
component looks as follows:
componentWillReceiveProps(newProps) {
// Pano received
const oldPanoID = this.props.match.params.panoID;
const newPanoID = newProps.match.params.panoID;
if (oldPanoID !== newPanoID) {
loadPano(newPanoID);
}
}
javascript reactjs redux react-redux
I'm encountering a rather strange problem with my ReactJS x Redux app that I've never seen before and am having a hard time figuring out.
In my ReactJS component I'm wiring up an action creator function that's using redux-thunk
to make async calls before dispatching to a reducer using the connect()
function from react-redux
+ the object mapDispatchToProps
notation. It looks like this:
const mapStateToProps = (state) => ({
...state.single_pano
});
const mapDispatchToProps = {
loadPano
};
export default connect(mapStateToProps, mapDispatchToProps)(PanoView);
For the sake of simplicity, let's say the loadPano
action creator looks something like this:
export const loadPano = (id) => {
console.log('Action creator called.');
return async (dispatch) => {
console.log('Dispatch function called.');
const doc = await db.doc('/path/to/doc/'+id).get();
dispatch({
type: 'LOAD_ACTION',
payload: doc
});
}
}
Here's where things get weird:
In my componentDidMount()
lifecycle function, I'm making a call to this.props.loadPano(panoID)
which works exactly as expected (both console.log()
calls in the action creator are invoked, the async
/await
returns and the action is dispatched to the reducer).
Later, I need to call this.props.loadPano(panoID)
again in the component's componentWillReceiveProps()
lifecycle function because a URL parameter is changed, and some data needs to be fetched and reloaded. HOWEVER, what ends up happening this time is the action creator (loadPano
) is called, but the redux-thunk
dispatch function (return (dispatch) => { ... }
) never gets called. I can tell this is the case because the first console.log()
is called, but the second one never is never logged to the console.
Other things slighty out of the ordinary that I'm doing that might be related, but so far I've been unable to confirm any of it:
- The
PanoView
component makes use ofshouldComponentUpdate()
lifecycle method to control when the DOM is rendered. - I'm being a little hacky / not best practice-y using a variable outside of the
PanoView
component's state to store an 3rd party library object that modifies the DOM directly via a DOMref
, and can't really be used properly in conjunction with ReactJS. However I believe this to be isolated, and can't see how it would be interfering with Redux / Thunk. Especially because the dispatch function fires correctly the first time.
Relevant dependencies + versions (installed via yarn
):
"firebase": "^5.2.0",
"photo-sphere-viewer": "^3.4.0",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-redux": "^5.0.7",
"react-router-dom": "^4.3.1",
"redux": "^4.0.0",
"redux-thunk": "^2.3.0"
Requested updates:
My componentWillReceiveProps
lifecylce function for the PanoView
component looks as follows:
componentWillReceiveProps(newProps) {
// Pano received
const oldPanoID = this.props.match.params.panoID;
const newPanoID = newProps.match.params.panoID;
if (oldPanoID !== newPanoID) {
loadPano(newPanoID);
}
}
javascript reactjs redux react-redux
javascript reactjs redux react-redux
edited Nov 20 '18 at 15:20
saricden
asked Nov 18 '18 at 12:13
saricdensaricden
4451926
4451926
Can you show where you're passing dispatch?
– Colin
Nov 18 '18 at 12:18
@Colin Not sure I understand, I'm using the object notation formapDispatchToProps
+react-redux
'sconnect()
to wire up the action creator to the component's props, then in the action creator I'm returning a function (utilizingredux-thunk
) that callsdispatch
after theawait
/ promise returns. I believeredux-thunk
is responsible for passing indispatch
.
– saricden
Nov 18 '18 at 12:42
Could you please share a link to github repo?
– Michal
Nov 20 '18 at 15:05
1
Uh currently it's hosted on a private Bitbucket repo... I've been meaning to move it to GH, but haven't gotten around to it yet.
– saricden
Nov 20 '18 at 15:11
1
@Michal I'll make it a priority tomorrow after I finish work. Should be able to get it up by EOD tomorrow (I'm on Korean Standard Time).
– saricden
Nov 20 '18 at 15:12
add a comment |
Can you show where you're passing dispatch?
– Colin
Nov 18 '18 at 12:18
@Colin Not sure I understand, I'm using the object notation formapDispatchToProps
+react-redux
'sconnect()
to wire up the action creator to the component's props, then in the action creator I'm returning a function (utilizingredux-thunk
) that callsdispatch
after theawait
/ promise returns. I believeredux-thunk
is responsible for passing indispatch
.
– saricden
Nov 18 '18 at 12:42
Could you please share a link to github repo?
– Michal
Nov 20 '18 at 15:05
1
Uh currently it's hosted on a private Bitbucket repo... I've been meaning to move it to GH, but haven't gotten around to it yet.
– saricden
Nov 20 '18 at 15:11
1
@Michal I'll make it a priority tomorrow after I finish work. Should be able to get it up by EOD tomorrow (I'm on Korean Standard Time).
– saricden
Nov 20 '18 at 15:12
Can you show where you're passing dispatch?
– Colin
Nov 18 '18 at 12:18
Can you show where you're passing dispatch?
– Colin
Nov 18 '18 at 12:18
@Colin Not sure I understand, I'm using the object notation for
mapDispatchToProps
+ react-redux
's connect()
to wire up the action creator to the component's props, then in the action creator I'm returning a function (utilizing redux-thunk
) that calls dispatch
after the await
/ promise returns. I believe redux-thunk
is responsible for passing in dispatch
.– saricden
Nov 18 '18 at 12:42
@Colin Not sure I understand, I'm using the object notation for
mapDispatchToProps
+ react-redux
's connect()
to wire up the action creator to the component's props, then in the action creator I'm returning a function (utilizing redux-thunk
) that calls dispatch
after the await
/ promise returns. I believe redux-thunk
is responsible for passing in dispatch
.– saricden
Nov 18 '18 at 12:42
Could you please share a link to github repo?
– Michal
Nov 20 '18 at 15:05
Could you please share a link to github repo?
– Michal
Nov 20 '18 at 15:05
1
1
Uh currently it's hosted on a private Bitbucket repo... I've been meaning to move it to GH, but haven't gotten around to it yet.
– saricden
Nov 20 '18 at 15:11
Uh currently it's hosted on a private Bitbucket repo... I've been meaning to move it to GH, but haven't gotten around to it yet.
– saricden
Nov 20 '18 at 15:11
1
1
@Michal I'll make it a priority tomorrow after I finish work. Should be able to get it up by EOD tomorrow (I'm on Korean Standard Time).
– saricden
Nov 20 '18 at 15:12
@Michal I'll make it a priority tomorrow after I finish work. Should be able to get it up by EOD tomorrow (I'm on Korean Standard Time).
– saricden
Nov 20 '18 at 15:12
add a comment |
1 Answer
1
active
oldest
votes
It is hard (almost impossible) to guess where the problem is when we don't know anything about your code. How does your componentWillReceiveProps
look like?
This is a good practice that might cause a confusion:
const mapDispatchToProps = {
loadPano
};
Redux thunk is essentially a middleware that checks every dispatched action. If the action returns a function, then it calls the function and then it passes dispatch
and state
parameters to the returned function and then it also calls this function.
So my guess is:
- In
componendDidMount
you are callingthis.props.loadPano(id)
- In
componentWillReceiveProps
you calling onlyloadPano
.
The first one is store.dispatch(loadPano)
and gets into the reducer. The second one is just loadPano
and returns a promise. (your action creator)
1
Updated the OP. I can't believe I missed this, you were totally correct. Thanks dude, much appreciated. Sometimes the most obvious answers slip right by when you're too close to the action.
– saricden
Nov 20 '18 at 15:22
1
I can't reward the bounty yet, but will as soon as I can. Thanks again.
– saricden
Nov 20 '18 at 15:23
1
I am glad it worked. :)
– Michal
Nov 20 '18 at 15:23
1
Going to be able to release the 2nd beta after this :) I was stuck on this problem all weekend.
– saricden
Nov 20 '18 at 15:37
1
Interesting, I'll defs still check it out, could be useful for future bugs :)
– saricden
Nov 20 '18 at 15:49
|
show 1 more comment
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53360725%2fredux-thunk-reactjs-action-creator-being-called-but-dispatch-function-not-bei%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
It is hard (almost impossible) to guess where the problem is when we don't know anything about your code. How does your componentWillReceiveProps
look like?
This is a good practice that might cause a confusion:
const mapDispatchToProps = {
loadPano
};
Redux thunk is essentially a middleware that checks every dispatched action. If the action returns a function, then it calls the function and then it passes dispatch
and state
parameters to the returned function and then it also calls this function.
So my guess is:
- In
componendDidMount
you are callingthis.props.loadPano(id)
- In
componentWillReceiveProps
you calling onlyloadPano
.
The first one is store.dispatch(loadPano)
and gets into the reducer. The second one is just loadPano
and returns a promise. (your action creator)
1
Updated the OP. I can't believe I missed this, you were totally correct. Thanks dude, much appreciated. Sometimes the most obvious answers slip right by when you're too close to the action.
– saricden
Nov 20 '18 at 15:22
1
I can't reward the bounty yet, but will as soon as I can. Thanks again.
– saricden
Nov 20 '18 at 15:23
1
I am glad it worked. :)
– Michal
Nov 20 '18 at 15:23
1
Going to be able to release the 2nd beta after this :) I was stuck on this problem all weekend.
– saricden
Nov 20 '18 at 15:37
1
Interesting, I'll defs still check it out, could be useful for future bugs :)
– saricden
Nov 20 '18 at 15:49
|
show 1 more comment
It is hard (almost impossible) to guess where the problem is when we don't know anything about your code. How does your componentWillReceiveProps
look like?
This is a good practice that might cause a confusion:
const mapDispatchToProps = {
loadPano
};
Redux thunk is essentially a middleware that checks every dispatched action. If the action returns a function, then it calls the function and then it passes dispatch
and state
parameters to the returned function and then it also calls this function.
So my guess is:
- In
componendDidMount
you are callingthis.props.loadPano(id)
- In
componentWillReceiveProps
you calling onlyloadPano
.
The first one is store.dispatch(loadPano)
and gets into the reducer. The second one is just loadPano
and returns a promise. (your action creator)
1
Updated the OP. I can't believe I missed this, you were totally correct. Thanks dude, much appreciated. Sometimes the most obvious answers slip right by when you're too close to the action.
– saricden
Nov 20 '18 at 15:22
1
I can't reward the bounty yet, but will as soon as I can. Thanks again.
– saricden
Nov 20 '18 at 15:23
1
I am glad it worked. :)
– Michal
Nov 20 '18 at 15:23
1
Going to be able to release the 2nd beta after this :) I was stuck on this problem all weekend.
– saricden
Nov 20 '18 at 15:37
1
Interesting, I'll defs still check it out, could be useful for future bugs :)
– saricden
Nov 20 '18 at 15:49
|
show 1 more comment
It is hard (almost impossible) to guess where the problem is when we don't know anything about your code. How does your componentWillReceiveProps
look like?
This is a good practice that might cause a confusion:
const mapDispatchToProps = {
loadPano
};
Redux thunk is essentially a middleware that checks every dispatched action. If the action returns a function, then it calls the function and then it passes dispatch
and state
parameters to the returned function and then it also calls this function.
So my guess is:
- In
componendDidMount
you are callingthis.props.loadPano(id)
- In
componentWillReceiveProps
you calling onlyloadPano
.
The first one is store.dispatch(loadPano)
and gets into the reducer. The second one is just loadPano
and returns a promise. (your action creator)
It is hard (almost impossible) to guess where the problem is when we don't know anything about your code. How does your componentWillReceiveProps
look like?
This is a good practice that might cause a confusion:
const mapDispatchToProps = {
loadPano
};
Redux thunk is essentially a middleware that checks every dispatched action. If the action returns a function, then it calls the function and then it passes dispatch
and state
parameters to the returned function and then it also calls this function.
So my guess is:
- In
componendDidMount
you are callingthis.props.loadPano(id)
- In
componentWillReceiveProps
you calling onlyloadPano
.
The first one is store.dispatch(loadPano)
and gets into the reducer. The second one is just loadPano
and returns a promise. (your action creator)
answered Nov 20 '18 at 15:16
MichalMichal
2,3721135
2,3721135
1
Updated the OP. I can't believe I missed this, you were totally correct. Thanks dude, much appreciated. Sometimes the most obvious answers slip right by when you're too close to the action.
– saricden
Nov 20 '18 at 15:22
1
I can't reward the bounty yet, but will as soon as I can. Thanks again.
– saricden
Nov 20 '18 at 15:23
1
I am glad it worked. :)
– Michal
Nov 20 '18 at 15:23
1
Going to be able to release the 2nd beta after this :) I was stuck on this problem all weekend.
– saricden
Nov 20 '18 at 15:37
1
Interesting, I'll defs still check it out, could be useful for future bugs :)
– saricden
Nov 20 '18 at 15:49
|
show 1 more comment
1
Updated the OP. I can't believe I missed this, you were totally correct. Thanks dude, much appreciated. Sometimes the most obvious answers slip right by when you're too close to the action.
– saricden
Nov 20 '18 at 15:22
1
I can't reward the bounty yet, but will as soon as I can. Thanks again.
– saricden
Nov 20 '18 at 15:23
1
I am glad it worked. :)
– Michal
Nov 20 '18 at 15:23
1
Going to be able to release the 2nd beta after this :) I was stuck on this problem all weekend.
– saricden
Nov 20 '18 at 15:37
1
Interesting, I'll defs still check it out, could be useful for future bugs :)
– saricden
Nov 20 '18 at 15:49
1
1
Updated the OP. I can't believe I missed this, you were totally correct. Thanks dude, much appreciated. Sometimes the most obvious answers slip right by when you're too close to the action.
– saricden
Nov 20 '18 at 15:22
Updated the OP. I can't believe I missed this, you were totally correct. Thanks dude, much appreciated. Sometimes the most obvious answers slip right by when you're too close to the action.
– saricden
Nov 20 '18 at 15:22
1
1
I can't reward the bounty yet, but will as soon as I can. Thanks again.
– saricden
Nov 20 '18 at 15:23
I can't reward the bounty yet, but will as soon as I can. Thanks again.
– saricden
Nov 20 '18 at 15:23
1
1
I am glad it worked. :)
– Michal
Nov 20 '18 at 15:23
I am glad it worked. :)
– Michal
Nov 20 '18 at 15:23
1
1
Going to be able to release the 2nd beta after this :) I was stuck on this problem all weekend.
– saricden
Nov 20 '18 at 15:37
Going to be able to release the 2nd beta after this :) I was stuck on this problem all weekend.
– saricden
Nov 20 '18 at 15:37
1
1
Interesting, I'll defs still check it out, could be useful for future bugs :)
– saricden
Nov 20 '18 at 15:49
Interesting, I'll defs still check it out, could be useful for future bugs :)
– saricden
Nov 20 '18 at 15:49
|
show 1 more comment
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53360725%2fredux-thunk-reactjs-action-creator-being-called-but-dispatch-function-not-bei%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you show where you're passing dispatch?
– Colin
Nov 18 '18 at 12:18
@Colin Not sure I understand, I'm using the object notation for
mapDispatchToProps
+react-redux
'sconnect()
to wire up the action creator to the component's props, then in the action creator I'm returning a function (utilizingredux-thunk
) that callsdispatch
after theawait
/ promise returns. I believeredux-thunk
is responsible for passing indispatch
.– saricden
Nov 18 '18 at 12:42
Could you please share a link to github repo?
– Michal
Nov 20 '18 at 15:05
1
Uh currently it's hosted on a private Bitbucket repo... I've been meaning to move it to GH, but haven't gotten around to it yet.
– saricden
Nov 20 '18 at 15:11
1
@Michal I'll make it a priority tomorrow after I finish work. Should be able to get it up by EOD tomorrow (I'm on Korean Standard Time).
– saricden
Nov 20 '18 at 15:12