Skip to content

Commit

Permalink
Merge link query strings with data in React adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
reinink committed Oct 17, 2020
1 parent 3d69045 commit 7b8b88c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/inertia-react/src/Link.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Inertia, shouldIntercept } from '@inertiajs/inertia'
import { hrefToUrl, Inertia, mergeQueryStringsWithData, shouldIntercept } from '@inertiajs/inertia'
import { createElement, useCallback, forwardRef } from 'react'

const noop = () => undefined
Expand Down Expand Up @@ -65,5 +65,9 @@ export default forwardRef(function InertiaLink({
],
)

const [url, _data] = mergeQueryStringsWithData(method, hrefToUrl(href), data)
href = url.href
data = _data

return createElement('a', { ...props, href, ref, onClick: visit }, children)
})

0 comments on commit 7b8b88c

Please sign in to comment.