"unit call from pure function" in UI #1324
|
Getting into a trouble: https://effector.dev/en/guides/troubleshooting/#unit-call-from-pure-not-supported I have sth like that: import { openChat } from './model.ts'
...
const onOpenChat = useUnit(openChat);
...
// component.tsx
onClick={() => {
setIsOpened(true);
onOpenChat(); // trouble ( despite onOpenChat: () => void )
}}// model.ts
export const chat = createChat(config);
export const openChat = createEvent();
sample({
clock: openChat,
target: chat.chatsPageOpened, // event that triggers effects
})Please, can you explain, how can I correctly connect my logic with ui? |
Answered by
KirillYuzh
Mar 19, 2026
Replies: 1 comment
|
There was an error, but not in this place. After a little bit of digging I found the source of the problem: I accidentally called an event inside createAction fn. Effector was showing onClick line as a place of the problem only because of the fact that the function (called in that line) was triggering chain of events including my createAction with an error. |
0 replies
Answer selected by
KirillYuzh
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There was an error, but not in this place. After a little bit of digging I found the source of the problem: I accidentally called an event inside createAction fn. Effector was showing onClick line as a place of the problem only because of the fact that the function (called in that line) was triggering chain of events including my createAction with an error.