Skip to content

calling setState inside renderRest function throws warning #23

Open

Description

@DavidTawil

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

Activity

  1. LohitakshTrehan commented on Jun 7, 2023

    @LohitakshTrehan

    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.

  2. LohitakshTrehan commented on Jun 7, 2023

    @LohitakshTrehan
    Screenshot 2023-06-08 at 2 28 06 AM Screenshot 2023-06-08 at 2 29 18 AM
  3. LohitakshTrehan commented on Jun 7, 2023

    @LohitakshTrehan
  4. jlissner commented on Aug 3, 2023

    @jlissner

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

  5. PavelGavlik commented on Aug 31, 2023

    @PavelGavlik

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

  6. chienweiluo commented on Sep 14, 2023

    @chienweiluo

    Same here. I met this when using multiple Select in antd@5.7.3.

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions