Skip to content
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

Potential bug in React.useEffect call #136

Open
Ptival opened this issue Jan 25, 2022 · 0 comments
Open

Potential bug in React.useEffect call #136

Ptival opened this issue Jan 25, 2022 · 0 comments
Assignees

Comments

@Ptival
Copy link
Contributor

Ptival commented Jan 25, 2022

Fairly sure the following:

React.useEffect(() => {
const handler = (e: MessageEvent) => {
return makeMessageListener({
setProjectName,
setSymbols,
})(e.data)
}
window.addEventListener('message', handler)
return () => {
window.removeEventListener('message', handler)
}
})

should have a [] as second argument to not repeat the effect on state change.

Should also check in the other component that listens to messages.

@Ptival Ptival self-assigned this Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant