question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

getLastActionKey doesn't seem to work?

See original GitHub issue

Hi,

I end up firing a bunch of actions to fetch some resources using:

yield all([put(fetchResource('abc123')), put(fetchResource('abc567'))]);

If fetchResource is a standard redux-saga-requests action I’d think I could prevent it from aborting the abc567 request by formulating my request using the action creator below (I’m using FSA compatible actions) but it still seems to abort my requests. There doesn’t seem to be a test written for request specific getLastActionKey so maybe this isn’t working as expected?

export const fetchResource = resourceId => ({
    type: types.FETCH_RESOURCE,
    payload: {
        request: {
            url: `/resource/${resourceId}`,
        },
    },
    meta: {
        resourceId,
        getLastActionKey: action => action.type + action.meta.resourceId
    },
});

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
klis87commented, Mar 27, 2019

@spacesuitdiver the only thing that comes to my mind is that you use an interceptor and you don’t take into account that you could get array of requests and responses, otherwise each action should be independent on another.

Maybe try to do this batch fetch in a simple project, for example by adjusting fetch example. Then see if it works. If yes, you could use it to simplest possible react native project, I didn’t test it but I guess that it should work there too. But you can never be sure.

0reactions
spacesuitdivercommented, Mar 29, 2019

@klis87 thanks again, request/response as array was the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

getLastActionKey doesn't seem to work? · Issue #239 · klis87/redux ...
Hi, I end up firing a bunch of actions to fetch some resources using: yield all([put(fetchResource('abc123')), put(fetchResource('abc567'))]); ...
Read more >
Declarative AJAX requests and automatic network state ...
With redux-requests , assuming you use axios (you could use it with ... There doesn't seem to be a test written for request...
Read more >
The redux-requests from klis87 - GithubHelp
createDriver doesn't seem to be exported from redux-saga-requests-axios. i'm developing a project with react-redux-boilerplate as a basis. so to reproduce ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found