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

calling setState inside renderRest function throws warning #23

Open
DavidTawil opened this issue Jun 6, 2022 · 6 comments
Open

calling setState inside renderRest function throws warning #23

DavidTawil opened this issue Jun 6, 2022 · 6 comments

Comments

@DavidTawil
Copy link

I'm trying to call setState inside the function that deals renderRest, in order to use those overflow elements inside a popup element.
But when calling the setState to keep those items for next render, I'm getting a warning in the console:
image

@LohitakshTrehan
Copy link

LohitakshTrehan commented Jun 7, 2023

I am facing same issue. I am rendering AntD Select in mode="multiple".
My JSX looks like following:

<Popover>
    <Form>
        <Form.Item>
            <Select mode="multiple" />
        </Form.Item>
    </Form>
</Popover>

I click on a button which fires "onFinish" of form and I close the popover by changing its state.
And I get this warning that the state(not my popover state) was set after component unmount.
After going through my code for any useEffect or setState mistake. I can confirm that this is happening in code. This error is not coming for single Select mode. Drilling in error log it indicates the error is coming from Overflow Component. Attaching screenshot.

@LohitakshTrehan
Copy link

Screenshot 2023-06-08 at 2 28 06 AM Screenshot 2023-06-08 at 2 29 18 AM

@LohitakshTrehan
Copy link

@afc163 @zombieJ ^

@jlissner
Copy link

jlissner commented Aug 3, 2023

I am seeing this error everywhere after updating to latest version of ant design :( would love some guidance

@PavelGavlik
Copy link

Any news regarding this issue? There seems to be even a fix in #37

@chienweiluo
Copy link

chienweiluo commented Sep 14, 2023

Same here. I met this when using multiple Select in [email protected].

update:
After edit the node_modules/rc-overflow/lib/hooks/useEffectState.js with PR#37 as @PavelGavlik mentioned, the error disappears.

the AbortController like #39 works in my scenario also(roughly), but I still have no solution without injection. Any solution for consumers so far?

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

5 participants