Whenever my useTransition hook uses async await next it throws an error of
Uncaught (in promise) TypeError: Cannot read property 'asyncId' of undefined
at _callee6$ (runAsync.ts:81)
...
Using Yarn Workspaces with react-spring version:
"react-spring": "9.0.0-canary.809.5.f01ecc2",
This is my code, based off https://github.com/react-spring/react-spring-examples/blob/pull-750/demos/hooks/notification-hub/index.js
const [refMap] = useState(() => new WeakMap())
const config = { tension: 125, friction: 20, precision: 0.1 }
const transitions = useTransition(blocks, {
initial: null,
from: { height: 0, opacity: 0, overflow: 'hidden' },
enter: item => async next => {
await next({ height: refMap.get(item).offsetHeight, opacity: 1, overflow: 'hidden', config })
},
leave: { height: 0, opacity: 0, overflow: 'hidden', config },
key: block => block.id,
})
return (
<div>
{transitions((style, block) => {
return (
<animated.div style={style}>
<div ref={ref => ref && refMap.set(block, ref)>
<Block block={block} />
</div>
</animated.div>
)
})}
</div>
)
Changing the transition to
const transitions = useTransition(blocks, {
initial: null,
from: { height: 0, opacity: 0, overflow: 'hidden' },
enter: { height: 100, opacity: 1, overflow: 'hidden', config },
leave: { height: 0, opacity: 0, overflow: 'hidden', config },
key: block => block.id,
})
resolves the issue but I don't get access to the ref/dynamic height of the element within the transition.
Any ideas if this is a react spring issue or somewhere else? The transition worked in v8. I upgraded because I wanted to be able properly get access to the updated state within item (https://github.com/react-spring/react-spring/issues/949).
could be related to: https://github.com/react-spring/react-spring/issues/920
You can find the latest canary here:
https://www.npmjs.com/package/react-spring?activeTab=versions
9.0.0-canary.808.17.55c5691 at the time of writing.
That should fix your issue. LMK if it doesn't. 馃憤
I did try that one, and also tried beta-34. I'll give it another shot with the one you mentioned and report back! 馃
Same issue @aleclarson:
"react-spring": "9.0.0-canary.808.17.55c5691",

Lovely. I can get this fixed before the next canary. Do you have a minimal reproducible build?
鉂わ笍 Let me try to put one together for you. Thanks for all the help.
edit: can't reproduce from blank CRA template. Going to attempt to strip down our codebase enough to reproduce it.
@aleclarson here's a repro: https://github.com/brotzky/react-spring-repro-issue-955
let me know if you're able to reproduce it or have questions.
Just tested your repro on the latest code. Should be fixed in 9.0.0-canary.808.18 which I will try to release in a day or two. 馃憤
Wow, amazing!! thanks so much @aleclarson. No rush -- take your time.
Now available in v9.0.0-rc.2 #985
Most helpful comment
Just tested your repro on the latest code. Should be fixed in
9.0.0-canary.808.18which I will try to release in a day or two. 馃憤