Skip to content

Allow ScrollProp to be optional#814

Open
gordanielyan wants to merge 1 commit intoinertiajs:2.xfrom
gordanielyan:2.x
Open

Allow ScrollProp to be optional#814
gordanielyan wants to merge 1 commit intoinertiajs:2.xfrom
gordanielyan:2.x

Conversation

@gordanielyan
Copy link

Inertia::scroll() is great for implementing infinite scrolling, but today it always loads as part of the initial response (or immediately after, when deferred).
This makes it awkward to use for shared data (e.g. notification list) that:

  • should not always be loaded
  • should only be fetched when actually needed
  • should integrate naturally with WhenVisible

This PR adds an optional() modifier:

Inertia::scroll(fn () => User::paginate())->optional();

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