inertia
inertia copied to clipboard
feat: allow null value for replace parameter
This PR will allow users to pass null to replace parameter. A null value means that neither a new state will be pushed nor a new state will be set. This can be handy for infinite scroll pages where the URL should not change but anyway new items should be loaded.
Hey @jaulz,
I'm a bit confused. Isn't this why the preserveState component exists? History-wise, you can either replace the current state, or push a new entry, but to 'keep' it sounds like an intermediate state without any state at all, which (to me) sounds problematic as it more or less 'disconnects' from reality?
@claudiodekker yep, you are right. It's an intermediate state that actually only exists at the time of scrolling down. Currently, there are two possibilities to solve the infinite scrolling:
- Navigate to "next" link (with preserveState) via Inertia but that will update the URL. When the user refreshes the page he will land somewhere in the middle which is fine for search results but not for collections sorted by a time based value (e.g. hotness factor)
- Use an AJAX request to retrieve the results of the "next" link which will not update the URL. Since this would technically work, you would lose all the Inertia magic (e.g. update other props, auth based redirect).
Thus, it would be great if we could navigate with Inertia without updating the URL to achieve this "intermediate" state.
Hey! Thanks so much for your interest in Inertia.js and for submitting this contribution.
In an attempt to get on top of the issues and pull requests on this project I am going through all the older issues and PRs and closing them, as there's a decent chance that they have since been resolved or are simply not relevant any longer. My hope is that with a "clean slate" me and the other project maintainers will be able to better keep on top of issues and PRs moving forward.
Of course there's a chance that this PR is still relevant, and if that's the case feel free to re-submit it. If it's a new feature and not a bug fix maybe respond here first to make sure that it's something we want to include in the library.
Really not trying to be dismissive here, I just need to find a way to get this project back into a state that I am able to maintain it. Hope that makes sense! ❤️