Skip to content

fix(settings): smooth scheduled task details expand and collapse - #701

Merged
nixuuu merged 2 commits into
devfrom
fix/schedule-row-accordion
Nov 14, 2026
Merged

nixuuu merged 2 commits into
devfrom
fix/schedule-row-accordion

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Problem

In Settings → Scheduled tasks, collapsing a task's details (the "N runs" disclosure) cleared the content at once and left a blank band. The rows below then snapped up instead of easing. The user's 120 fps recording shows the clip shrinking far faster than the row box.

Cause

expandGrid (motion.ts) tweened grid-template-rows: t fr on the wrapper. In an auto-height grid, Chromium sizes the wrapper to t × content but the t fr track (the clipping child) to t² × content. Measured in headless Chromium at t = 0.5: wrapper 84 px, clip 42 px. Content vanished early, and the leftover band snapped shut when the element unmounted. Expanding had the same mismatch in reverse.

Fix

  • expandGrid(node) tweens the wrapper's measured height (--duration-fast, --ease-smooth-out, with a fade), and the 1fr track follows it exactly (verified: wrapper = clip at every step). The height comes from the clipping child's scrollHeight, so a toggle reversed mid-way keeps its scale. Reduced motion stays instant. The grid mode of Disclosure (activity frames) gets the same fix.
  • The schedule row body is now a flex column, and the details wrapper cancels its 2 px gap (-mt-0.5 / pt-2.5), so nothing moves at either end of the motion. A grid row would clamp the negative margin. The final layout is unchanged.
  • Mobile: details used to mount at full height in one frame. A new shared ui/Accordion (measured height + fade on fast, the same both ways, instant with reduced motion) makes the cards below glide. JS only; the runtime fingerprint is unchanged, so it ships OTA.

Fixes: #694
Related: #491

Checks

  • bun install, bun run gen:check, bun run typecheck, bun run lint, bun run format:check: clean
  • web build: passed; expo export iOS + Android: passed; fingerprint sources contain none of the changed files
  • Browser review on an isolated stack: built web, fixture schedules, Chromium via Playwright, sampled every animation frame:
    • Before: on collapse the clip fell far behind the wrapper, leaving a blank band, then the rows snapped.
    • After, collapse at 1440 px light: wrapper = clip on every frame (246 → 174 → 81 → 32 → 11 → 3 → 0 px), next row 525 → 279 px, no step at mount or unmount. Expand mirrors it.
    • After, 390 px dark: the same (298 → 0 px).
    • With prefers-reduced-motion: reduce it is instant both ways.
    • Pre-existing and unrelated: an intermittent Cannot read properties of undefined (reading 'component') in SvelteKit's client router on the first navigation. It reproduces on plain dev (4397875) in the same stack.
  • Mobile: typecheck and export pass; not checked on a device.

Copy audit (§8)

No UI text changes.

Collapsing a scheduled task row cleared its content at once and left a
blank band, then the rows below snapped up. The grid accordion tweened a
`t fr` track inside an auto-height grid: the browser sized the wrapper to
t × content but the track (the clip) to t² × content.

`expandGrid` now tweens the wrapper's measured height on --duration-fast
with --ease-smooth-out, so the 1fr track always matches it and content,
height and fade move together both ways. The height comes from the
clipping child's scroll height, so a reversed toggle keeps its scale. The
closed wrapper cancels the row gap, so nothing moves by 2px at either
end. Reduced motion stays instant. Activity disclosures that use the grid
mode get the same fix.

Mobile details mounted at full height in one frame. They now open and
close in a shared `Accordion` (measured height + fade on `fast`), so the
cards below glide with them.

Fixes: #694
Related: #491
@nixuuu
nixuuu marked this pull request as ready for review November 14, 2026 11:23
@nixuuu
nixuuu merged commit a324126 into dev Nov 14, 2026
11 checks passed
@nixuuu
nixuuu deleted the fix/schedule-row-accordion branch November 14, 2026 11:30
nixuuu added a commit that referenced this pull request Nov 14, 2026
Opening or closing mobile tool details, tool groups and work segments
can jump to unrelated history. This change computes an absolute scroll
target from the tapped header's position within its actual inverted
FlatList cell, so repeated measurements keep the header under the finger
instead of accumulating scroll corrections.

Fixes: #554
Related: #689, #701, #721

### Root cause and evidence

- Extracted the supplied 11.24-second iPhone recording at 12 fps (135
frames). Around 0.9–1.1 seconds the view changes from the latest “Worked
for 10s” segment to earlier “Worked for 19s” history, back to the
expanded segment and then to unrelated newer content. The
composer/navigation remain fixed while timeline content moves in both
directions. Later toggles also move surrounding messages, rather than
only the disclosed body. The recording cannot establish native offsets,
React render counts or which native anchor ran.
- The list is an inverted native FlatList, virtualized by **turn**, with
variable measured heights; no FlashList, estimated `getItemLayout` or
fold-dependent turn keys. #689 retains fold choices outside virtual
cells. #701's `ui/Accordion` is used by scheduled-task settings, not the
timeline. Timeline work/groups use the height animation from #554;
individual item details mount directly and share its anchor hook.
- In pinned Reanimated 4.7.1, native `measure` reads
`UIManager::getRelativeLayoutMetrics`, whose page coordinates include
the Fabric scroll-state checkpoint. Native `scrollTo` and the checkpoint
are not one atomic measurement. The old frame callback subtracted `pageY
- originalPageY` from an optimistically updated offset every frame.
Re-reading an unchanged checkpoint therefore compounded the same
correction. This is a code-established failure path consistent with the
recording, not a device reproduction.
- React Native 0.88.1's iOS maintain-visible implementation captures its
first-visible frame before mounting and applies it afterward. Disabling
then re-enabling the prop can apply the old frame on the enabling
commit. Keep it configured, suppress autoscroll during the manual
session, and keep iOS keyboard chats configured without zero-target
autoscroll.

### Implementation

Measure both header and actual cell on UI. Their page-coordinate
difference cancels the common scroll checkpoint; cell layout Y/height
locate the header within inverted content. Preserve the session's
initial offset/position and derive each target from that origin.
Identical layout always gives an identical target, even if scroll events
are delayed or native cell anchoring also adjusts the offset. Changes
before the turn are included; height added above a nested header cancels
naturally.

Use `createAnimatedComponent(FlatList)` with a stable component
identity, since Reanimated's convenience `Animated.FlatList`
unconditionally replaces `CellRendererComponent`. Preserve inversion
styles, focus and list layout notifications. Keep disclosure animation,
retained children, turn keys, manual choices and drag/new-tap
cancellation. The physical scroll range still limits anchoring when the
remaining content is shorter than the viewport.

### Validation

- `nice bun install`, `nice bun run gen:check`, full `nice bun run
typecheck`, `nice bun run lint`, `nice bun run format` and `nice bun run
format:check`: passed. All temporary files use a private `/var/tmp`
directory.
- Focused tests: `nice bun test
tests/integration/mobile-disclosure-anchor.test.ts
tests/integration/thread-scroll.test.ts`: **7 passed, 40 assertions**.
Three new pure geometry tests cover stale/repeated scroll checkpoints,
expansion/collapse, nested/preceding-cell changes, reversal and
iOS/Android lower bounds. No UI suites.
- Final iOS and Android Hermes exports passed, run sequentially with
`nice`.
- Production-profile EAS fingerprints were generated against clean base
`dev` and the implementation: **unchanged**. iOS
`83794f069934a7374461427d89b8d008cec19d97`; Android
`141ef4e8c825ee4fc5d22c499402b284741b0970`. iOS also matches the last
delivered nightly store build. No dependencies, native configuration or
native sources changed.
- Native device checks are blocked by the supplied device-host failure.
Export/test success does not prove native frame pacing, rendered-cell
counts or phone anchoring. No E2E/UI suites, full integration suite or
web build were run for this mobile-only change.

### Re-test on iPhone and Android

Published directly to **nightly** by the implementing agent without
authorization, from `0601f2ea4bf96feb70c1f920420ae6d3730cc31b`, for both
existing runtimes. The OTA keeps the last delivered JS release version
`0.3.0-nightly.12`; its message is `Canopy v0.3.0-nightly.12 +
disclosure anchor fix (0601f2e)`.
Publishing reported success and returned the same runtime fingerprints
checked above:

- iOS update `01a1daa3-fa24-7e7d-8bed-1b03e10041a7`, group
`62c3742a-aabb-4860-9a44-6bcc754df97b`.
- Android update `01a1daa3-fa24-7f83-a58e-e0cd0ce3ed78`, group
`e0c51f88-99a6-4b60-937e-02c19a9257dc`.

No native build, new release tag or release-version commit was created.
Release preparation files were restored afterward. Merge this PR so
subsequent scheduled nightly releases retain the fix.

On the phone, use Settings → Updates to fetch/apply the new nightly OTA
before these checks:

1. In a long thread, scroll to the middle and put a completed work
header near the top, middle and bottom of the viewport. Expand/collapse
it ten times, then repeat for its tool group and a tall individual
command/tool result. The tapped header and messages above it must stay
at the same screen Y; only content below changes. No unrelated history
may flash into view.
2. Repeat at the latest turn while following, with short and very tall
results. Rapidly reverse a disclosure before its 250 ms animation ends
and tap another header mid-transition. The new tap must own the anchor.
A physically too-short collapsed thread may reach its scroll boundary.
3. Repeat with keyboard open/closed and system Reduce Motion on/off.
Drag during expansion: the drag must take over immediately, and
programmatic corrections must not fold the composer. Check light/dark
and narrow/wide layouts with long labels.
4. Load older history, toggle again, switch away/back, then use “Jump to
latest” and receive a new message. Retained choices/history must
survive, the reading position must hold, and explicit following must
still work. Also check bot chat scrolling/keyboard because it shares the
base list wrapper.

Copy audit (docs/copy.md §8): no UI text changed. Relevant Polish docs
updated. Temporary frames, exports and logs are removed after delivery.
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.

1 participant