inertia
inertia copied to clipboard
[V2] Improve WhenVisible component to merge data and params props for a more flexible API
This PR fixes #2025
Enhancements
-
Merge
dataandparamsprops:
This PR introduces a more flexible API that merges thedataandparamsprops. Now, you can pass both in a single configuration like this:<WhenVisible fallback="Loading..." data={["todos", "pagy"]} params={{ data: { teste: true, page: pagy.page + 1, }, preserveUrl: true, }} /> -
Make children optional in
WhenVisible:
Which enhances use cases likeInfiniteScroll. Here’s an example:<WhenVisible fallback="Loading..." params={{ data: { page: pagy.page + 1, }, only: ["todos", "pagy"], preserveUrl: true, }} />