-
-
Notifications
You must be signed in to change notification settings - Fork 235
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
Effector react: unmounted component #574
Comments
could you share an example online please? either in our repl or codesandbox |
this is gonna be tricky, because I have a complex app with all sorts of setups in react, so not sure how to replicate this to a small example. We could have a screen sharing chat if that would help :) |
From the description it is not clear what kind of error you have and what code could lead to it. |
ok I will try to checkout effector sources and npm link it for debugging, maybe something useful comes out |
Hi, I have now changed |
Can you share the error message? Is this something like this?
(If yes, then you might want to look at this discussion in |
I might have closed this prematurely, still getting the bug, but what worries me is that in my flow of affected components I have no useState() or useEffect() at work and yet I'm getting this error from apiBase.ts:131 |
Thanks for mentioning exact line of code, now I clearly see why this happened. That behavior could be improved on our side |
@mendrik should be fixed in effector-react 22.0.6 |
awesome, thank you! |
I tested it some more, and i'm still getting it at not sure if it helps but my code is relatively simple, this is the component that causes the stacktrace: export const VisualNode = ({ depth = 0, node }: Jsx<OwnProps>) => {
const id = node.value.id
const isActive = useStoreMap($selectedNode, pathEq(['value', 'id'], id))
const openNodes = useStore($openNodes)
const hasChildren = isNotNilOrEmpty(node.children)
const open = openNodes[id]
const nodeType = node.value.nodeType
return (
<>
{depth > 0 && (
<NodeGrid
tabIndex={0}
onFocus={() => selectNode(node)} // <- this line
id={id}
className={clsx('gap-1', { selectedNode: isActive })}
>
... and my store is: import { createStore } from 'effector'
import { nthArg } from 'ramda'
import { TreeNode } from '~shared/algebraic/treeNode'
import { Node } from '~shared/types/domain/node'
import { resetProject } from '../events/reset'
import { selectNode } from '../events/tree'
export const $selectedNode = createStore<TreeNode<Node> | null>(null)
.on(selectNode, nthArg(1))
.reset(resetProject) it happens when I quickly close and open UI nodes, which unmounts some |
Damn, then it happens on the react side, don’t know how we would manage that, at least without explicit reproduction |
What is the current behavior:
I'm getting a react error while modifying a store value on fx.done
What is the expected behavior:
is that a problem with resolving promises in unmounted components? Since I don't use useEffect myself this seems like a bug in the library
"effector": "22.1.2",
"effector-react": "22.0.5"
The text was updated successfully, but these errors were encountered: