Skip to content

perf: initialize pager hook resources once - #1124

Open
OskarEichler wants to merge 1 commit into
callstack:masterfrom
OskarEichler:codex/pager-hook
Open

perf: initialize pager hook resources once#1124
OskarEichler wants to merge 1 commit into
callstack:masterfrom
OskarEichler:codex/pager-hook

Conversation

@OskarEichler

@OskarEichler OskarEichler commented Aug 27, 2026

Copy link
Copy Markdown

Summary

perf: initialize pager hook resources once. Fixes #1107.

Compatibility / observable changes

No public API change. pagesAmount remains an initialization-only input; subsequent rerenders no longer allocate discarded page arrays or Animated.Values.

Implementation

usePagerView recreates initial page arrays and Animated.Values on each render. The change is kept independent from the other source-review fixes. This contribution is AI-assisted.

Test Plan

  • Real React renderer checks cover ten rerenders, stable handlers and three retained Animated.Values, add/remove page behavior, and initialization-only page arrays.
  • Each independent PR's source overlay passes the root TypeScript check.
  • Combined review branch: bun run typescript, bun run lint (zero errors; 25 existing example warnings), bun run prepare, and git diff --check pass.
  • Combined example: Android Debug (./gradlew assembleDebug --max-workers=4), iOS Simulator Release (xcodebuild, signing disabled), and both production Metro bundles pass with its RN 0.85.3 dependencies.
  • Across the combined changes: 26 JS/React, 15 UIKit/provider, six ObjC++ and 21 Kotlin checks pass. Native API doubles and real UIKit execution are distinguished above.
  • Clean packaging of the combined branch includes the independent declaration-output fix proposed for Clean install fails because generated declarations do not match the package types entrypoint #1109; other PRs do not silently include that unrelated change.

No checked-in test files were added or modified. The existing Jest suite contains one TODO and no executed tests; focused external diagnostics provide the behavioral checks.

Prerequisites and reproduction

See #1107 for the baseline, reproduction and proposed fix.

Checklist

  • Tested on a physical device
  • Complete OS/device matrix

Downstream RN 0.87.1 verification

The combined 9.0.2 consumer artifact is pinned at 35a43b89b9e658c926a647a5b8bf9c7863e73771. Immutable install and byte comparison of all 66 non-metadata files pass. Both Android Debug variants, both iOS Debug Simulator variants, four production Metro bundles, 13 web builds, four extension builds and app lint pass. The first Android attempt encountered a concurrent web-output replacement during Gradle input hashing; serial rerun passed. The upstream iOS example also launches and renders its home screen. This does not cover physical devices or the complete Maestro interaction matrix.

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.

usePagerView recreates initial page arrays and Animated.Values on each render

1 participant