Skip to content

Conversation

@damienguezou
Copy link
Collaborator

In next js when a href is set with a UrlObject. It threw an error "target.startsWith is not a function".

For example, when using a linkProps Button params like:

linkProps: {
  href: {
    pathname: '/contact',
  },
},

it throw the error "target.startsWith is not a function"

When the href is an UrlObject, I format it to a string. I used the format function which is obsolete but I didn't find a good alternative yet and I don't have much time right now to look more, sorry. I do this PR if that can help you

Tests done:

linkProps: {
  href: {
    protocol: 'https',
    host: 'google.fr',
    pathname: '/contact',
  },
},

linkProps: {
  href: {
    protocol: 'mailto',
    hostname: 'dguezou@luminess.eu',
  },
},

linkProps: {
  href: '/contact'
},

In next js when a href is set with a UrlObject. It threw an error
@garronej
Copy link
Collaborator

Ok, thanks for reporting.
Hold on, I'm releasing a fix.

garronej added a commit that referenced this pull request Mar 31, 2023
@garronej
Copy link
Collaborator

Oh sorry I didn't see it was a PR, I though it was an issue.

Anyway, it's fixed in the latest release.

Thanks again,

@garronej garronej closed this Mar 31, 2023
sbourdon13 pushed a commit to sbourdon13/react-dsfr that referenced this pull request Aug 11, 2023
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.

3 participants