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

useTransition unable to unmount with async leave #920

Closed
guopengliang opened this issue Jan 30, 2020 · 4 comments
Closed

useTransition unable to unmount with async leave #920

guopengliang opened this issue Jan 30, 2020 · 4 comments
Labels
kind: bug Something isn't working
Milestone

Comments

@guopengliang
Copy link
Contributor

🐛 Bug Report

When using async function as the leave prop in useTransition, the component always fails to update and unmount the child once the async function resolves.

To Reproduce

Steps to reproduce the behavior:

const Example = ({ toggle }) => {
    const transition = useTransition(toggle, {
        from: { x: 0 },
        enter: { x: 200 },
        // Cannot unmount with async leave
        leave: () => async (next) => {
            await next({ x: 300 });
            await next({ x: 0 });
        },
        // Can unmount with:
        // leave: { x: 0 },
    });

    return transition((values, item) => item && (
        <animated.div style={values} />
    ));
};

Expected behavior

The <animated.div> should unmount when the async leave resolves.

Environment

  • react-spring v9.0.0-canary.808.15.d4e5904
  • react v16.12.0
@guopengliang guopengliang added the kind: bug Something isn't working label Jan 30, 2020
@guopengliang
Copy link
Contributor Author

Same bug using react-spring v9.0.0-canary.808.17.55c5691

@aleclarson aleclarson added the v9 label Jan 30, 2020
@aleclarson
Copy link
Contributor

Please provide a minimal CodeSandbox or git url that shows the issue. 👍

@aleclarson
Copy link
Contributor

This is fixed in the next canary (9.0.0-canary.808.18). To be released soon.

aleclarson added a commit that referenced this issue Apr 19, 2020
aleclarson added a commit that referenced this issue May 3, 2020
@aleclarson
Copy link
Contributor

Now available in v9.0.0-rc.2 #985

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants