Skip to content

fix(v2): sticky indices behavior#401

Open
huextrat wants to merge 4 commits intoLegendApp:mainfrom
huextrat:fix/sticky-indices-behavior
Open

fix(v2): sticky indices behavior#401
huextrat wants to merge 4 commits intoLegendApp:mainfrom
huextrat:fix/sticky-indices-behavior

Conversation

@huextrat
Copy link
Contributor

@huextrat huextrat commented Feb 20, 2026

fixes: #400

v3 -> #402

Simulator.Screen.Recording.-.iPhone.17.Pro.-.2026-02-20.at.16.00.07.mov

Addresses an issue with sticky header indices.
Improves header behavior for push effect.

It now computes next sticky position and item size.
Adds a property to determine the position.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ffab6a0e9d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +479 to +483
if (currentStickyArrayIdx >= 0 && currentStickyArrayIdx < stickyIndicesArr.length - 1) {
const nextStickyDataIndex = stickyIndicesArr[currentStickyArrayIdx + 1];
const nextStickyId = idCache[nextStickyDataIndex] ?? getId(state, nextStickyDataIndex);
const nextStickyPos = nextStickyId ? positions.get(nextStickyId) : undefined;
const prevNextPos = peek$(ctx, `containerStickyNextPosition${containerIndex}`);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reset stale next sticky position for terminal sticky headers

This branch only updates containerStickyNextPosition when a following sticky index exists, so containers that become the last sticky header keep their old next value. After sticky-index/data changes (for example a list going from [0,10,20] to [0,10]), PositionViewSticky still sees a next position and applies push behavior, which can incorrectly push the final sticky header off-screen even though there is no successor. Clearing containerStickyNextPosition in the non-successor case avoids this stale state.

Useful? React with 👍 / 👎.

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.

Sticky headers are stacked, causing issues with headers of different height

1 participant