Skip to content

fix(mobile): improve font-size slider performance and prevent maximum update depth errors - #7138

Merged
juliusmarminge merged 6 commits into
pingdotgg:mainfrom
bbernag:fix/mobile-font-size-update-on-release
Sep 7, 2026
Merged

fix(mobile): improve font-size slider performance and prevent maximum update depth errors#7138
juliusmarminge merged 6 commits into
pingdotgg:mainfrom
bbernag:fix/mobile-font-size-update-on-release

Conversation

@bbernag

@bbernag bbernag commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

What Changed

  • Keep drag progress entirely in Reanimated shared values while the finger is down.
  • Commit the final snapped font size to mobile preferences once when the gesture finishes.
  • Return cancelled gestures to the committed value without applying an update.
  • Preserve immediate commits for taps and accessibility increment/decrement actions.

Why

The slider previously crossed to JavaScript and wrote mobile preferences for every intermediate pan value. Updating the base text size also reapplies app-wide typography variables, so rapid back-and-forth scrubbing could queue global renders, leave the slider replaying delayed values after release, and eventually trigger Maximum update depth exceeded.

With this change, only the slider thumb and fill move during a drag. The preview, value label, global typography, and persisted preference remain unchanged until release, when the final snapped value is committed once.

UI Changes

There is no visual redesign. The interaction now defers all font-size updates until the slider is released.

Before

Heavy scrubbing could repeatedly update global typography, lag behind the gesture, continue after release, and trigger the maximum update depth error.

Screen.Recording.2026-08-15.at.3.01.30.p.m.mp4

After

The thumb and fill track the gesture smoothly, and the selected font size is applied globally once on release.

Screen.Recording.2026-08-15.at.3.00.12.p.m.mp4

Validation

  • Mobile tsc --noEmit
  • Targeted vp lint --report-unused-disable-directives
  • Targeted vp fmt --check
  • git diff --check
  • Android emulator held-drag check: value remained unchanged before release
  • Android emulator release check: the final snapped value committed after UP
  • Original font-size preference restored after runtime validation
  • Rules review found no violations

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after videos for the interaction change

Built with GPT-5 using the Codex desktop harness.


Note

Low Risk
Localized interaction change in settings appearance sliders; main risk is any consumer expecting continuous onChange during drag, which now only fires once on successful release (plus tap/a11y).

Overview
Pan drags on the appearance font-size slider no longer call onChange on every move. While dragging, only Reanimated progress updates so the thumb and fill track the finger without touching persisted preferences or global typography.

On pan end, a successful gesture snaps progress to the stepped value and calls commit once (with haptics). A cancelled/failed pan animates back to the current value and does not invoke onChange. Taps still commit immediately on end; accessibility increment/decrement is unchanged.

Gesture useMemo now depends on value so failed drags can reset to the latest committed size.

Reviewed by Cursor Bugbot for commit acc6aac. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix font size slider to commit changes only on gesture release

  • onChange and haptics are no longer fired continuously during a pan drag; they fire once when the gesture successfully finalizes with the snapped value.
  • If the pan gesture fails, the slider animates back to the current value without calling onChange.
  • Tap gestures still commit once on tap end, and gesture memoization now updates when value changes.
  • Behavioral Change: apps relying on continuous onChange callbacks during drag will now only receive a single callback on release.

Macroscope summarized acc6aac.

Summary by CodeRabbit

  • Bug Fixes
    • Improved font size slider behavior when dragging.
    • Cancelled gestures now restore the current setting, while completed gestures correctly snap to and save the selected value.

Keep drag progress on the UI thread and commit the snapped preference once when the gesture finalizes. This avoids app-wide re-renders, lag, and maximum update depth failures during heavy slider scrubbing.
@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: d68a30f6-a0f1-4bf5-ad10-3b5cdd197be3

📥 Commits

Reviewing files that changed from the base of the PR and between bc3dc26 and 47590e4.

📒 Files selected for processing (1)
  • apps/mobile/src/features/settings/appearance/components/FontSizeSliderRow.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The font size slider now distinguishes cancelled and successful pan gestures. Cancelled gestures restore the current value. Successful gestures snap and commit the value derived from animated progress.

Changes

Font size slider gesture handling

Layer / File(s) Summary
Gesture finalization and commit handling
apps/mobile/src/features/settings/appearance/components/FontSizeSliderRow.tsx
commit caches the latest value. Cancelled pans restore the current value. Successful pans derive a snapped value from progress.value. Gesture memoization includes value.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 47590

The slider now commits font-size changes only after successful drag completion while cancelled drags restore the saved value. The supplied checks indicate the intended mobile behavior is ready to merge.

Suggested reviewers: juliusmarminge

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the mobile font-size slider fix and its performance and update-depth goals. It matches the main changes in the pull request.
Description check ✅ Passed The description includes the required What Changed, Why, UI Changes, and Checklist sections. It explains the behavior change, provides before-and-after interaction videos, and documents validation res…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Aug 15, 2026
@macroscopeapp

macroscopeapp Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved 5061496

Small, self-contained UX change that moves font size commit from continuous drag updates to only on slider release. Limited to a single mobile settings component with clear intent and low risk.

You can customize Macroscope's approvability policy. Learn more.

@bbernag bbernag changed the title fix(mobile): update font size only after slider release perf(mobile): eliminate render cascades during font-size scrubbing Aug 15, 2026
@bbernag bbernag changed the title perf(mobile): eliminate render cascades during font-size scrubbing fix(mobile): update font size only after slider release Aug 15, 2026
@bbernag bbernag changed the title fix(mobile): update font size only after slider release fix(mobile): improve font-size slider performance and prevent maximum update depth errors Aug 15, 2026
@juliusmarminge
juliusmarminge enabled auto-merge (squash) September 7, 2026 07:25
@juliusmarminge
juliusmarminge merged commit 062987b into pingdotgg:main Sep 7, 2026
23 checks passed
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Sep 7, 2026
## What's Changed
* fix(mobile): keep pending messages in the chat timeline by @juliusmarminge in pingdotgg/t3code#10449
* fix(mobile): show connection status in the floating pill instead of a second one by @juliusmarminge in pingdotgg/t3code#10440
* fix: use Pierre icons consistently for attachments by @juliusmarminge in pingdotgg/t3code#10475
* feat(mobile): open the thread screen as soon as a new task is submitted by @juliusmarminge in pingdotgg/t3code#10435
* fix(devcontainer): make repository setup work by @saphid in pingdotgg/t3code#7875
* fix(projects): prevent invalid script IDs from crashing threads by @saphid in pingdotgg/t3code#10019
* fix(mobile): hide changed-files navigator and restore refresh in raw diff fallback by @lnieuwenhuis in pingdotgg/t3code#9828
* fix(ios): scroll short source files from blank space by @juliusmarminge in pingdotgg/t3code#10178
* feat(mobile): start a new thread on an existing branch by @StiensWout in pingdotgg/t3code#10359
* fix(mobile): improve font-size slider performance and prevent maximum update depth errors by @bbernag in pingdotgg/t3code#7138
* fix(web): keep composer toolbar controls anchored during transitions by @juliusmarminge in pingdotgg/t3code#10478
* fix(web): resize the floating preview from any edge by @juliusmarminge in pingdotgg/t3code#10467
* fix(mobile): prevent chat from disappearing when scrolling by @juliusmarminge in pingdotgg/t3code#10479
* fix(mobile): smooth composer status pill resizing by @juliusmarminge in pingdotgg/t3code#10484
* fix(mobile): release initial scroll target after dragging by @juliusmarminge in pingdotgg/t3code#10483
* fix(mobile): animate thread lifecycle transitions consistently by @juliusmarminge in pingdotgg/t3code#10487
* fix(mobile): restore assistant message bottom padding by @juliusmarminge in pingdotgg/t3code#10491
* fix(mobile): preserve chat rows when toggling commands by @juliusmarminge in pingdotgg/t3code#10492

## New Contributors
* @bbernag made their first contribution in pingdotgg/t3code#7138

**Full Changelog**: pingdotgg/t3code@v0.0.39-nightly.20260907.1332...v0.0.40-nightly.20260907.1346

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.40-nightly.20260907.1346
raman325 added a commit to raman325/t3code that referenced this pull request Sep 7, 2026
* origin/main: (675 commits)
  fix(web): tolerate servers that predate git identity in project import (pingdotgg#10547)
  chore(mobile): bump app version to 1.1.0
  fix(mobile): wait for native thread scroll before reveal (pingdotgg#10486)
  fix(mobile): match Working status color to desktop
  fix(web): remove inserted citations on cancel (pingdotgg#10518)
  feat(web): group onboarding project import by repository (pingdotgg#10493)
  fix(mobile): preserve chat rows when toggling commands (pingdotgg#10492)
  fix(mobile): restore assistant message bottom padding (pingdotgg#10491)
  fix(mobile): animate thread lifecycle transitions consistently (pingdotgg#10487)
  fix(mobile): release initial scroll target after dragging (pingdotgg#10483)
  fix(mobile): smooth composer status pill resizing (pingdotgg#10484)
  fix(mobile): prevent chat from disappearing when scrolling (pingdotgg#10479)
  fix(web): resize the floating preview from any edge (pingdotgg#10467)
  fix(web): keep composer toolbar controls anchored during transitions (pingdotgg#10478)
  fix(mobile): improve font-size slider performance and prevent maximum update depth errors (pingdotgg#7138)
  feat(mobile): start a new thread on an existing branch (pingdotgg#10359)
  fix(ios): scroll short source files from blank space (pingdotgg#10178)
  fix(mobile): hide changed-files navigator and restore refresh in raw diff fallback (pingdotgg#9828)
  fix(projects): prevent invalid script IDs from crashing threads (pingdotgg#10019)
  fix(devcontainer): make repository setup work (pingdotgg#7875)
  ...

# Conflicts:
#	apps/server/src/provider/builtInDrivers.ts
#	docs/README.md
#	docs/user/install.md
#	packages/contracts/src/settings.test.ts
#	packages/contracts/src/settings.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants