Skip to content

Conversation

@hcopp
Copy link
Contributor

@hcopp hcopp commented Jan 9, 2026

What changed? Why?

This PR fixes a couple of bugs with scrubber beacon on mobile.

  1. Updating value of idlePulse (going from false to true or true to false) wasn't working on the new react arch.
  2. Spread operator was causing crashes

Root cause (required for bugfixes)

Spread operator doesn't work in react-native-reanimated's worklets, and was causing issues on the new architecture specifically. It doesn't seem to reliably cause issues but we have had issues elsewhere with charts and even in Collapsible.

Worklets are functions that can run on a different JS thread, most often the UI thread. You can learn more about them here.

UI changes

Testing

This was tested with our mobile-app and a test app that is on the new react-native arch.

How has it been tested?

  • Unit tests
  • Interaction tests
  • Pseudo State tests
  • Manual - Web
  • Manual - Android (Emulator / Device)
  • Manual - iOS (Emulator / Device)

Testing instructions

To test with the new architecture, you can clone this test repo and then build mobile-visualization and update the files in node_modules in the test repo to have the updated package. This should allow you to test before and after!

Illustrations/Icons Checklist

Required if this PR changes files under packages/illustrations/** or packages/icons/**

  • verified visreg changes with Terran (include link to visreg run/approval)
  • all illustration/icons names have been reviewed by Dom and/or Terran

Change management

type=routine
risk=low
impact=sev5

automerge=false

@hcopp hcopp self-assigned this Jan 9, 2026
@cb-heimdall
Copy link
Collaborator

cb-heimdall commented Jan 9, 2026

✅ Heimdall Review Status

Requirement Status More Info
Reviews 1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 1
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1
CODEOWNERS ✅ See below

CODEOWNERS

Code Owner Status Calculation
ui-systems-eng-team 1/1
Denominator calculation
Additional CODEOWNERS Requirement
Show calculation
Sum 0
0
From CODEOWNERS 1
Sum 1

// Create instant transition to reset pulse after delay
const instantTransition: Transition = { type: 'timing', duration: 0 };
const resetWithDelay = { ...instantTransition, delay: pulseRepeatDelay };

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This spread operator was causing the crash, getting rid of ... solves the issue. We have discussed this before, not sure why this didn't get fixed as well, it caused bugs in other spots previously and it comes down to how the spread operator is compiled and that function not being available in the UI thread.

const idlePulseShared = useSharedValue(idlePulse ?? false);
useEffect(() => {
idlePulseShared.value = idlePulse ?? false;
}, [idlePulse, idlePulseShared]);
Copy link
Contributor Author

@hcopp hcopp Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

State changes of idlePulse wasn't working in new react-native arch. Didn't find other components in charts that have this issue.

// Convert idlePulse prop to SharedValue so useAnimatedReaction can detect changes.
// In the new React Native architecture, regular JS props are captured by value in worklets
// and won't update when the prop changes.
const idlePulseShared = useSharedValue(idlePulse ?? false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: do you think it would be cleaner if we default assign idlePulse = false in the component props (line 50), so you don't have to do idlePulse ?? false multiple times.

Copy link
Contributor Author

@hcopp hcopp Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good callout. Normally we seem to shy away from setting to false, but not sure 100% why we do it. I know setting default to false in JSDocs is not great but internally not a big deal.

Next time I touch this I'll see if I can do !!idlePulse or even just allow undefined values.

@hcopp hcopp merged commit 3461ce0 into master Jan 9, 2026
24 checks passed
@hcopp hcopp deleted the hunter/mobile-scrubber-idle-pulse branch January 9, 2026 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants