Skip to content

iOS: remove every surplus page spacer layer, not every other one - #18

Merged
artemlitch merged 1 commit into
masterfrom
fernando/page-spacers-remove-every-surplus-layer
Oct 3, 2026
Merged

artemlitch merged 1 commit into
masterfrom
fernando/page-spacers-remove-every-surplus-layer

Conversation

@delcamf

@delcamf delcamf commented Oct 2, 2026

Copy link
Copy Markdown

Problem

When the page sends fewer page spacers than before, stale spacer strips stay on screen. layoutPageSpacers in apple/RNCWebViewImpl.m trims the overlay by iterating sublayers while removing layers from it. The getter hands out the live array. Each removal shifts the rest down, and the loop skips every other layer, so about half of the surplus stays.

The Bookwise riffle (readwiseio/rekindled#13077) hits this when it leaves its zoomed-out view, and works around it on the page side.

Fix

Iterate a copy of sublayers. One line.

Checks

  • A standalone program over CALayer: 182 layers trimmed to 4 leave 93 with the live array and 4 with a copy.
  • Not built into Reader or Bookwise yet. The pin bump in rekindled follows this PR.

layoutPageSpacers trims the overlay to the spacer count by iterating
sublayers while removing from it. The getter hands out the live array,
so each removal shifts the rest down and the loop skips every other
layer. A page that sends fewer spacers keeps stale strips. Iterating a
copy removes them all.

Checked with a standalone program over CALayer: 182 layers trimmed to
4 leave 93 with the live array and 4 with a copy. Not built into the
app.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@delcamf
delcamf marked this pull request as ready for review October 2, 2026 22:44
@delcamf

delcamf commented Oct 2, 2026

Copy link
Copy Markdown
Author

piper review

@artemlitch
artemlitch merged commit ab11a3d into master Oct 3, 2026
6 of 9 checks passed
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