[bug]: transitioning background with gradient causes error
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- css, react, typescript
Research direction
Start with the @react-spring/web target and reproduce the failure in the linked CodeSandbox using the provided useSprings and sidebarApi.start example. Trace the background-value interpolation that rejects solid colors, gradients, or oklch(), and consider the issue done when solid-to-gradient transitions no longer throw or jump unexpectedly.
Written by the indexing model from the issue text.
Description
Which react-spring target are you using?
-
@react-spring/web -
@react-spring/three -
@react-spring/native -
@react-spring/konva -
@react-spring/zdog
What version of react-spring are you using?
9.7.4
What's Wrong?
When using background css property as a spring value and trying to transition it produces an error when being transitioned with a gradient.
Uncaught (in promise) Error: Cannot animate between _J and HJ, as the "to" prop suggests
at v0._merge (chunk-sdxbpvym.js:1:33453)
at E (chunk-sdxbpvym.js:1:20623)
at U (chunk-sdxbpvym.js:1:20503)
at chunk-sdxbpvym.js:1:20302
at new Promise (<anonymous>)
at TZ (chunk-sdxbpvym.js:1:20074)
at v0._update (chunk-sdxbpvym.js:1:32158)
at chunk-sdxbpvym.js:1:31167
at Array.map (<anonymous>)
at v0.start (chunk-sdxbpvym.js:1:31145)
The arity of each "output" value must be equal
HTMLUnknownElement.callCallback
https://hpj9rs.csb.app/node_modules/react-dom/cjs/react-dom.development.js:4164:14
Object.invokeGuardedCallbackDev
https://hpj9rs.csb.app/node_modules/react-dom/cjs/react-dom.development.js:4213:16
invokeGuardedCallback
https://hpj9rs.csb.app/node_modules/react-dom/cjs/react-dom.development.js:4277:31
invokeGuardedCallbackAndCatchFirstError
https://hpj9rs.csb.app/node_modules/react-dom/cjs/react-dom.development.js:4291:25
executeDispatch
https://hpj9rs.csb.app/node_modules/react-dom/cjs/react-dom.development.js:9041:3
processDispatchQueueItemsInOrder
https://hpj9rs.csb.app/node_modules/react-dom/cjs/react-dom.development.js:9073:7
processDispatchQueue
https://hpj9rs.csb.app/node_modules/react-dom/cjs/react-dom.development.js:9086:5
dispatchEventsForPlugins
https://hpj9rs.csb.app/node_modules/react-dom/cjs/react-dom.development.js:9097:3
eval
https://hpj9rs.csb.app/node_modules/react-dom/cjs/react-dom.development.js:9288:12
batchedUpdates$1
https://hpj9rs.csb.app/node_modules/react-dom/cjs/react-dom.development.js:26140:12
batchedUpdates
https://hpj9rs.csb.app/node_modules/react-dom/cjs/react-dom.development.js:3991:12
dispatchEventForPluginEventSystem
https://hpj9rs.csb.app/node_modules/react-dom/cjs/react-dom.development.js:9287:3
dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay
https://hpj9rs.csb.app/node_modules/react-dom/cjs/react-dom.development.js:6465:5
dispatchEvent
https://hpj9rs.csb.app/node_modules/react-dom/cjs/react-dom.development.js:6457:5
dispatchDiscreteEvent
https://hpj9rs.csb.app/node_modules/react-dom/cjs/react-dom.development.js:6430:5
To Reproduce
Create a spring similar to the following and use the api to start transitioning to a gradient. The colors do not have to be oklch but there is an additional bug where using oklch makes the animation jump from a plain color right to the gradient without transition.
//numItems: number
const [sidebarSprings, sidebarApi] = useSprings(numItems, () => ({
background: '#eaeaea',
color: '#2c2c2c',
}));
// index: number
sidebarApi.start((i) => {
return {
background: i === index ? 'linear-gradient(to right, oklch(0.6 0.14 305), oklch(0.6 0.14 260))' : '#eaeaea',
color: i === index ? '#ffffff' : '#2c2c2c',
};
});
Expected Behaviour
I expect that I can transition from a solid color background into a gradient smoothly. It is possible to make a workaround where you return a new gradient string to transition the gradient however it still does not transition it instantly applies changes. This workaround does not work for some colors like when using oklch(). It should be possible to transition background gradient colors smoothly.
Link to repo
- Dominant language
- TypeScript
- Stars
- 29.3k
- Forks
- 1.2k
- Avg merge
- 3d 15h
- Merged PRs (30d)
- 17
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pmndrs/react-spring
-
template: bug
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
pmndrs/react-spring#2656 ·
Maintainers usually reply within 1 day
-
area: core kind: request
Difficulty 4/5 3-5 days Newbie friendliness 55/100
pmndrs/react-spring#2542 ·
Maintainers usually reply within 1 day
-
area: typescript kind: request release: major
Difficulty 4/5 3-5 days Newbie friendliness 52/100
pmndrs/react-spring#2541 · 1 comment ·
Maintainers usually reply within 1 day
-
release: major type: RFC
Difficulty 5/5 Over a week Newbie friendliness 35/100
pmndrs/react-spring#2522 · 1 comment ·
Maintainers usually reply within 1 day
-
[bug]: Tab crash with skipAnimation and loopPossibly taken @mrityunjay-pandey claimed this 43 days ago. Openarea: core kind: bug
Difficulty 3/5 1-2 days Newbie friendliness 52/100
pmndrs/react-spring#2409 ·
Maintainers usually reply within 1 day
All issues in pmndrs/react-spring
Similar issues
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 82/100
lingdojo/kana-dojo#34714 · 1 comment · 5 reactions ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 70/100
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
manaflow-ai/cmux#59692 ·
Maintainers usually reply within 1 day
-
Retire stale Python-parity labels in Rust ingress and auth testsPossibly taken @github-actions claimed this today. Openfactory factory:building factory:unowned ralph-status:in-progress via:opencode-free/hy4-flash-free
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
JoshCLWren/comic-pile#5874 · 2 comments ·
Maintainers usually reply within 1 day
-
area: community lane: free-agent priority: P1 roadmap type: task
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
velella-sh/offing#1046 ·
Maintainers usually reply within 1 day