Skip to content

fix: inline time utility worklet calculations#7335

Merged
janicduplessis merged 1 commit intodevelopfrom
@janic/fix-time-worklet-inline-math
Apr 13, 2026
Merged

fix: inline time utility worklet calculations#7335
janicduplessis merged 1 commit intodevelopfrom
@janic/fix-time-worklet-inline-math

Conversation

@janicduplessis
Copy link
Copy Markdown
Contributor

@janicduplessis janicduplessis commented Apr 10, 2026

Fixes APP-3620

What changed (plus any additional context for devs)

Extracted from the new arch migration PR #6924.

The time utility functions (minutes, hours, days, weeks) use recursive worklet-to-worklet calls (e.g., time.minutes() calls time.seconds()). In newer Reanimated and worklet runtimes required for new arch, calling one worklet function from inside another worklet fails due to how worklet closures are serialized.

Replaces recursive calls with inline arithmetic. Each function now directly computes milliseconds instead of delegating to another worklet. The results are identical.

What to test

Tested previously in the RN upgrade branch, verified the error happened before and not after this fix.

  • yarn jest src/state/internal/queryStore/queryStore.test.ts β€” exercises time.minutes() and time.days() for cache/stale time configs

Replace recursive worklet-to-worklet calls with inline math in
time utility functions. Calling one worklet from another worklet
can fail in newer Reanimated/worklet runtimes.
@linear
Copy link
Copy Markdown

linear Bot commented Apr 10, 2026

@janicduplessis janicduplessis requested a review from olerass April 10, 2026 19:47
@github-actions
Copy link
Copy Markdown

πŸ§ͺ Flashlight Performance Report (AWS Device Farm)

πŸ”€ Commit: 365cde2

πŸ“Ž View Artifacts

Metric Current Ξ” vs Baseline
Time to Interactive (TTI) 5567 ms –
Average FPS 56.89 –
Average RAM 390.4 MB –

@janicduplessis
Copy link
Copy Markdown
Contributor Author

Not tested manually, partially covered by unit tests and obvious fix.

@github-actions
Copy link
Copy Markdown

Launch in simulator or device for 365cde2

@janicduplessis janicduplessis merged commit 73b0ef3 into develop Apr 13, 2026
20 checks passed
@janicduplessis janicduplessis deleted the @janic/fix-time-worklet-inline-math branch April 13, 2026 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants