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

dApp: Fix issue with the incorrect order of hooks for ActionFormModal #454

Merged
merged 1 commit into from
Jun 6, 2024

Conversation

kkosiorowska
Copy link
Contributor

Depends on #439

We were getting the error “React detected a change in the order of hooks” when we closed and opened the deposit and withdrawal flow alternately. The problem was that we were calling renderComponent directly, even though it is a react component. That causes react to treat the hook calls inside the function as part of ActionFormModal, even though we meant for them to be part of StakeFormModal/UnstakeFormModal.

More info here

UI

Before

Screen.Recording.2024-06-06.at.12.49.12.mov

After

Screen.Recording.2024-06-06.at.13.28.39.mov

We were getting the error “React detected a change in the order of hooks” when we closed and opened the deposit and withdrawal flow alternately.  The problem was that we were calling `renderComponent` directly, even though it is a react component. That causes react to treat the hook calls inside the function as part of `ActionFormModal`, even though we meant for them to be part of `StakeFormModal`/`UnstakeFormModal`.

More info here: https://stackoverflow.com/questions/57397395/react-has-detected-a-change-in-the-order-of-hooks-but-hooks-seem-to-be-invoked
@kkosiorowska kkosiorowska added the 🎨 dApp dApp label Jun 6, 2024
@kkosiorowska kkosiorowska self-assigned this Jun 6, 2024
@kkosiorowska kkosiorowska changed the title Fix issue with the incorrect order of hooks for ActionFormModal dApp: Fix issue with the incorrect order of hooks for ActionFormModal Jun 6, 2024
@r-czajkowski r-czajkowski merged commit 68117fa into withdrawal-flow Jun 6, 2024
20 checks passed
@r-czajkowski r-czajkowski deleted the fix-hooks-issue branch June 6, 2024 11:32
@nkuba nkuba mentioned this pull request Jun 10, 2024
@nkuba nkuba mentioned this pull request Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants