I use inertia-vue and implemented a paginator component wrapping Laravel's paginate() (toArray).
The links object of the response returns null when there are no previous or next pages:
// on the last page
{
links: {
first: 'https://url.com?page=1',
last: 'https://url.com?page=4',
next: null,
prev: 'https://url.com?page=3',
},
}
// on the first page
{
links: {
first: 'https://url.com?page=1',
last: 'https://url.com?page=4',
next: 'https://url.com?page=2,
prev: null,
},
}
I noticed there is a required-validator in the inertia-link component for the href-prop, and I was able omit this behaviour by sending a random string (in my case '#' and set pointer-events: none;.
Very tiny annoyance. I forked to try and apply a fix, but don't have the testing resources required to do so confidently.
To sum it all up: If the href-prop is null, I would expect the element to be rendered, but not have any click event handlers, or similar, applied.
Alternatively add a disabled-prop which would terminate early.
I agree that the href prop shouldn't be required.
If the href-prop is null, I would expect the element to be rendered, but not have any click event handlers, or similar, applied.
However, I don't agree with this. If href is empty, it should link to the current page to mirror the a tag behaviour.
Whatever is decided, this change should apply to both the Vue 2 and Vue 3 adapters.
Most helpful comment
I agree that the
hrefprop shouldn't be required.However, I don't agree with this. If
hrefis empty, it should link to the current page to mirror theatag behaviour.Whatever is decided, this change should apply to both the Vue 2 and Vue 3 adapters.