Skip to content

Commit 9a35e53

Browse files
committed
add stresstest to demos/simple
1 parent 4a7c56c commit 9a35e53

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

examples/demos/simple-transition/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState, useCallback } from 'react'
1+
import React, { useState, useCallback, useEffect } from 'react'
22
import { useTransition, animated } from 'react-spring/hooks'
33
import './styles.css'
44

@@ -17,6 +17,11 @@ const pages = [
1717
]
1818

1919
export default function App() {
20+
const [, fU] = useState()
21+
// It should not matter if the component is re-rendered, it shouldn't drop out of sync
22+
useEffect(() => void setInterval(fU, 100), [])
23+
console.log('r')
24+
2025
const [index, set] = useState(0)
2126
const onClick = useCallback(
2227
() => set(state => (state === 2 ? 0 : state + 1)),

examples/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import examples from './components/examples-hooks'
66
import './styles.css'
77

88
//const DEBUG = false
9-
const DEBUG = 'fresh'
9+
const DEBUG = 'simple'
1010

1111
ReactDOM.render(
1212
<DemoGrid fullscreen={!!DEBUG}>

src/animated/Controller.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,9 @@ export default class Controller {
187187
fromValues: toArray(parent.getValue()),
188188
toValues: toArray(target ? toValue.getPayload() : toValue),
189189
immediate: callProp(immediate, name),
190-
delay: withDefault(toConfig.delay, delay || 0),
190+
delay: this.isActive
191+
? 0
192+
: withDefault(toConfig.delay, delay || 0),
191193
initialVelocity: withDefault(toConfig.velocity, 0),
192194
clamp: withDefault(toConfig.clamp, false),
193195
precision: withDefault(toConfig.precision, 0.01),

src/useChain.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function useChain(refs, timeSteps, timeFrame = 1000) {
99

1010
useEffect(() => {
1111
local.current = ++guid
12-
//refs.forEach(({ current }) => current && current.stop())
12+
//refs.forEach(({ current }) => current && current.stop({ finished: true }))
1313
if (timeSteps) {
1414
frames.current.forEach(clearTimeout)
1515
frames.current = []

0 commit comments

Comments
 (0)