react-component/overflow

calling setState inside renderRest function throws warning

DavidTawil opened this issue · 6 comments

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

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.

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

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

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?