Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<Link> does not ignore the onClick event handler #5

Merged
merged 3 commits into from
Feb 16, 2024

Conversation

apademide
Copy link
Contributor

In the current implementation, the onClick prop is discarded by the applied onClick: (e) => visit(e) handler.
This fix ensures the handler is correctly passed down and ran. It then only runs the visit() function if the event wasn't default prevented, giving the user the possibility to cancel the visit by cancelling the click.

Also added the types to match the props type.

@iksaku
Copy link
Owner

iksaku commented Feb 16, 2024

I'm sorry, but the Link component functionality in the official Inertia libraries is not intended to work with custom click handlers, only directly with the router.

@iksaku iksaku closed this Feb 16, 2024
@iksaku
Copy link
Owner

iksaku commented Feb 16, 2024

Sorry my bad, it is a correct detail that I was missing. Going to checkout the code

@iksaku iksaku reopened this Feb 16, 2024
@iksaku iksaku merged commit 141c9c2 into iksaku:main Feb 16, 2024
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.

2 participants