question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[v9.0.0-rc.3] useTransition fails to leave in IE11

See original GitHub issue

When using /web.cjs I seem to be having an issue in IE11 where the element fades in, but won’t fade out or unmount.

Example component that fails to “leave” in IE

import React from "react";
import { useTransition, animated } from "react-spring/web.cjs";

export default function App() {
  const [hidden, setHidden] = React.useState(false);
  const transition = useTransition(hidden, {
    from: { opacity: 0 },
    enter: { opacity: 1 },
    leave: { opacity: 0 }
  });

  return (
    <div>
      {transition(
        (props, item) =>
          item && <animated.div style={props}>Some hide/show text</animated.div>
      )}
      <button onClick={() => setHidden(!hidden)}>Show/Hide</button>
    </div>
  );
}

Kapture 2020-05-15 at 15 15 58

Everything appears to work without issue in all other browers I’ve tested so I’m guessing it’s just a bug. There aren’t any exceptions thrown.

_Originally posted by @KB1RMA in https://github.com/react-spring/react-spring/issues/985#issuecomment-629433487_

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
KB1RMAcommented, Jul 24, 2020

@aleclarson I’ve been able to confirm this ultimately did end up being a polyfill issue and not related to transpilation.

Nextjs had omitted 2 very specific polyfills from core-js. 'core-js/features/function/name' and 'core-js/features/object/keys' .

Definitely thanks to @tomdohnal for saving me from pulling my hair out trying to track this down.

I think we can close this to tidy up your bug list

1reaction
KB1RMAcommented, May 20, 2020

I had a little more time to dig into this so I want to provide a bit more information as it looks like more is broken than I initially had thought.

I’ve confirmed I’m putting all the @react-spring libraries through babel-loader:

  • @react-spring/web
  • @react-spring/core
  • @react-spring/shared
  • @react-spring/animated

In addition to my initial example not unmounting, I’ve now noticed that this simple example only using useSpring appears to be broken as well.

Chrome outputs ["opacity"] to the console: image

However IE outputs an empty array for props: image

import { useSpring, animated } from "@react-spring/web";

export default function App() {
  const [hidden, setHidden] = React.useState(false);
  const props = useSpring({ opacity: hidden ? 0 : 1 });

  console.log(Object.keys(props));

  return (
    <div>
      <animated.div style={props}>Some hide/show text</animated.div>
      <button onClick={() => setHidden(!hidden)}>Show/Hide</button>
    </div>
  );
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found