Error with new versions of react-spring
whitphx opened this issue · 4 comments
Hello,
recently new versions of react-spring
, one of Sancho's dependencies, are released and it seemed to make sancho broken.
sancho
now specifies its dependent react-spring
's version as ^9.0.0-beta.31
, which is compatible with recently released version 9.0.0-canary.809.3.a66b280
.
However, 9.0.0-canary.809.3.a66b280
has changes making the error:
index.js:1368 Uncaught TypeError: Cannot read property 'key' of null
at useTransition (index.js:1368)
at Positioner (Positions.js:14)
at renderWithHooks (react-dom.development.js:16367)
at mountIndeterminateComponent (react-dom.development.js:18731)
at beginWork$1 (react-dom.development.js:20061)
at HTMLUnknownElement.callCallback (react-dom.development.js:363)
at Object.invokeGuardedCallbackDev (react-dom.development.js:412)
at invokeGuardedCallback (react-dom.development.js:465)
at beginWork$$1 (react-dom.development.js:25711)
at performUnitOfWork (react-dom.development.js:24616)
at workLoopSync (react-dom.development.js:24592)
at performSyncWorkOnRoot (react-dom.development.js:24153)
at react-dom.development.js:12313
at unstable_runWithPriority (scheduler.development.js:818)
at runWithPriority$2 (react-dom.development.js:12259)
at flushSyncCallbackQueueImpl (react-dom.development.js:12308)
at flushSyncCallbackQueue (react-dom.development.js:12296)
at flushPassiveEffectsImpl (react-dom.development.js:25345)
at unstable_runWithPriority (scheduler.development.js:818)
at runWithPriority$2 (react-dom.development.js:12259)
at flushPassiveEffects (react-dom.development.js:25283)
at react-dom.development.js:25162
at workLoop (scheduler.development.js:762)
at flushWork (scheduler.development.js:717)
at MessagePort.performWorkUntilDeadline (scheduler.development.js:212)
sancho
's Positioner
calls react-spring
's useTransition
with a second argument props
= null: https://github.com/bmcmahen/sancho/blob/master/src/Positions.tsx#L58
but newer versions of react-spring
's useTransition
refers props.*
: https://github.com/react-spring/react-spring/blob/1ae91daa655d6c67624fd88a5a53f5423314da01/packages/core/src/useTransition.tsx#L114
Ref: versions of react-spring
https://www.npmjs.com/package/react-spring?activeTab=versions
Hmmm good catch. Thanks. I think we should probably use v8 and specify it as a peer dependency. I’ll try to sort this out soon (though I’m on holiday, so could take a while)
Everything seems to be working okay w/ beta-34.Unfortunately v8 would require a more substantial rewrite than I have time for right now.
I'm really looking forward to a stable release of v9 so that I can properly update it!
Thank you and I understand the current situation and am looking forward to stable v9 too.
Then, however, this issue seems not to be resolved yet by setting the dependency react-spring version to "^9.0.0-beta.34"
https://github.com/bmcmahen/sancho/blob/master/package.json#L44
because it still also matches versions like 9.0.0-canary.808.4.e67bf81
, which cause this problem.
Ref: https://yarnpkg.com/en/docs/dependency-versions#toc-pre-release-tags
Ref: https://jubianchi.github.io/semver-check/#/^9.0.0-beta.34/9.0.0-canary.808.4.e67bf81
I think it could be one option to remove ^
from the version setting like "9.0.0-beta.34"
not to use canary versions
@bmcmahen Hi,
I found that this error is still there though sancho
's package.json is fixed to depend on react-spring@9.0.0-beta.34
.
It is because sancho
has dependencies which depends on react-spring@^9.0.0-beta.34
(there is ^
) such as toasted-notes
, react-gesture-stack
, and react-page-controller
, which leads to install react-spring@9.0.0-canary.809.5.f01ecc2
.
As a result, there are 2 versions of react-spring
in the installed directory and 9.0.0-canary.809.5.f01ecc2
is used and error occurs.
Now I'm avoiding this problem by setting "resolutions" in package.json.
...
"resolutions": {
"sancho/**/react-spring": "9.0.0-beta.34"
},
...