Skip to content

fix: reuse initial path on mobile charts - #837

Merged
hcopp merged 2 commits into
masterfrom
hunter/improve-chart-perf
Aug 10, 2026
Merged

hcopp merged 2 commits into
masterfrom
hunter/improve-chart-perf

Conversation

@hcopp

@hcopp hcopp commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

What changed? Why?

This PR updates our mobile charts transition to reuse initial path, based on feedback I saw in #777

ChartPerfTest.mov

Testing

Simply test that ChartTransitions work as expected

How has it been tested?

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

Testing instructions

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 Aug 10, 2026
@cb-heimdall

cb-heimdall commented Aug 10, 2026 •

Copy link
Copy Markdown
Collaborator

✅ 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

// Re-renders must not re-parse SVG; lazy useState seeds useSharedValue on mount only.
const [initialSkiaPath] = useState(
() => Skia.Path.MakeFromSVGString(initialPath ?? currentPath) ?? Skia.Path.Make(),
);

@adrienzheng-cb adrienzheng-cb Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we declare it as a ref?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@adrienzheng-cb we could, we'd need to do something like

const initialSkiaPathRef = useRef(null); // not sure what type is off the top of my header

if (initialSkiaPathRef.current === null) { 
  initialSkiaPathRef.current = Skia.Path.MakeFromSVGString(initialPath ?? currentPath) ?? Skia.Path.Make()
}

Since useRef doesn't support lazy loading. Would you prefer this?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

o I see. let's keep the useState then. I was asking because I prefer refs to states, whose update methods are unused.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for thinking about this!

@adrienzheng-cb
adrienzheng-cb self-requested a review August 10, 2026 16:28
@hcopp
hcopp merged commit 8e47983 into master Aug 10, 2026
34 checks passed
@hcopp
hcopp deleted the hunter/improve-chart-perf branch August 10, 2026 16:29
@github-actions

Copy link
Copy Markdown
Contributor

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