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.

Actions always trigger useEffect when in dependencies

See original GitHub issue

I have useEffects in my codebase that have little-state-machine actions as dependencies, everything worked fine until I update little-state-machine from version "3.1.2" to 4.1.0. Now Actions call every time useEffect and re-render my components. Also tried with TS demo sample from your docs, only added this effect : useEffect(() => { console.log("called every time"); actions.updateFirstLastName({ yourDetails: { firstname: "testFirst", lastname: "testLast" } }); }, [actions]);
in Form.tsx file. And got same result.

Not sure what to do, can someone help?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
bluebill1049commented, Jun 5, 2021

thanks, should be fixed in the next patch.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does useEffect trigger on mount for Context API ... - Reddit
The dependency array tells useEffect when it should run again. It will always run at least once, when the component mounts. That's why...
Read more >
The last guide to the useEffect Hook you'll ever need
Dependencies are array items provided as the optional second argument of the useEffect call. Array values must be from the component scope ...
Read more >
Triggering useEffect only certain conditions - Stack Overflow
Say I have useEffect with two dependencies (from GraphQL query): result.data and result.loading . I want useEffect to run if result.data changes ...
Read more >
How to manage the useEffect dependency array like a pro?
The useEffect hook allows you to perform side effects in a functional component. There is a dependency array to control when the effect...
Read more >
4 Ways to useEffect() - DEV Community ‍ ‍
To call a function conditionally, specify the list of dependencies. And the rule of thumb is to always add those dependencies that you...
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