Skip to content

beforeShot hook: run after the scroll pass, right before the shot #71

Closed

Description

@tmashara

What
A route hook that runs after renderdiff's own settle (the scroll pass, image decode and network idle), right before masks are read and shots are taken. For example beforeShot, next to before.

Why
before runs before the scroll pass, and the scroll pass undid the state a hook had set. Two cases from a 208-route marketing run:

  • A scroll-spy nav. It kept whichever section the last scroll event saw, so the active tab came out as Soon on one side and Later on the other.
  • A demo iframe. Its container height was re-measured after the hook, 538 vs 544 px.

Each needed a workaround and cost a full ~20-minute cycle:

  • a scroll listener that restores the nav's load-time classes at scrollY === 0;
  • an !important height pin injected from before.

How
Call the hook at the end of prepare/settle in capture.ts, on both sides, with the same signature as before. Document which one to use: before to open a state, beforeShot to undo what the scroll pass changed.

Activity

  1. added
    enhancement
    on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions