Delay when using declarative widthCallback
See original GitHub issueI am seeing a delay when using the widthCallback. My code is simple enough:
<mesh
ref={mesh}
rotation={[0, Math.PI, 0]}
>
<meshLine
attach="geometry"
points={points}
widthCallback={pointWidth => pointWidth * 5 * Math.random()}
/>
<meshLineMaterial
attach="material"
lineWidth={width}
color={color}
/>
</mesh>
I see this:
and then after waiting a long time (1-3 minutes), I get the desired:
Any guess? The function component doesn’t appear to be stale - it’s on a timer and rendering twice a second
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Delay region playback in Logic Pro - Apple Support
You can shift the playback position of regions on a track using the Delay parameter. Positive values shift regions ahead in time (laid-back...
Read more >Latency Issues with Interfaces – Focusrite Audio Engineering
When you are recording audio with your interface, you might notice a slight delay in the audio coming back to you. This delay...
Read more >The audio and video are out of sync or there is an audio delay.
If the TV is connected to a soundbar or home theater system (with an HDMI cable or optical cable), the sound may be...
Read more >Audio Latency for VoIP - How it Impacts Call Quality & Ways to ...
Two-way latency measures the round trip time. Both measurements can affect the customer journey with VoIP. Here, we take a deeper dive into ......
Read more >Our Soundbar Connectivity Tests: Latency - RTINGS.com
High latency or audio lag is a surefire way to ruin a climactic ... High latency can be noticeable mostly with lip sync...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I should be able to find the time to test it later in the weekend but if you have the time basically
this.widthCallback
needs to be replaced with a getter for declarative architectures so we can do a redraw. I imagine if you added the following toObject.defineProperties
on line 32 it should work.Then we use the new getter
You could alternatively keep the
widthCallback
name and rename all the existing reference to_widthCallback
Hmm looks like it doesn’t redraw with
widthCallback
. If you set the widthCallback before you set the points it should work. I imagine the delay is a result of waiting for the component to rerender in which setPoints is called again. Should be able to do a PR to fix.