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.

filter-ed promises not being executed in componentDidMount

See original GitHub issue

BEGIN_GLOBAL_LOAD/END_GLOBAL_LOAD are dispatched on the client side even when filter stops the asyncConnect from blocking the render function. However, once the component is mounted, since the redux has saved the state loaded as true, it does not fetch the data. Due to this you have to manually redo the logic for re-fetching data in these instances. It would be nice to have some logic to ascertain that the promise is executed in componentDidMount.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
idangozlancommented, Dec 20, 2016

is there any solution / workaround for now?

1reaction
bobbypriambodocommented, Dec 7, 2016

I’ve just encountered this today, having just migrated from the unmaintained redux-async-connect@1.0.0-rc4. As such, I reverted back. It kinda sucks, I really wanted to leave redux-async-connect, since it complains that the react peerDependency version does not match, I’m using the latest 15.4.1.

Are the solutions provided not good enough?

Ideally I wanted to change the line where it checks for the “load” prop in componentDidMount, but not on the root of the reducer state, but for each prop with “key”, but because of that we’ll have to make sure that “key” is required for filtering

^ Is this a feasible solution?

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - .filter(...).then is not a function in componentDidMount
Well yes, filter() always returns a new, filtered array. It doesn't return a Promise. Read more: developer.mozilla.org/en-US/docs/Web/JavaScript ...
Read more >
Executing Promises in a React Component - Pluralsight
I am using the async/await syntax to handle the promise that fetch returns, as well as the promise returned by calling json() on...
Read more >
Returning a Promise value from fetch - JavaScript
EDIT: The reason you are getting setState is not a function is because this is currently bound to your then callback. You need...
Read more >
`useEffect()` and `async` - DEV Community ‍ ‍
setState() [from inside componentDidMount()]; render(). Even though there is a second render, the React Docs state that the user will not see ...
Read more >
Fetching Data in React using Hooks | by Chidume Nnamdi
useEffect is used to execute functions after a component gets rendered (to “perform side effects”). useEffect can be limited to cases where a ......
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