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

Issue when using the Magic Link feature in a Next.js project #212

Open
mcdermc opened this issue Nov 18, 2024 · 1 comment
Open

Issue when using the Magic Link feature in a Next.js project #212

mcdermc opened this issue Nov 18, 2024 · 1 comment

Comments

@mcdermc
Copy link

mcdermc commented Nov 18, 2024

Hi,
I am using the Magic Link feature in a Next.js project.
I can input the email address to which I want to receive the magic link, and I receive the Magic link in an email.
But when I click on the magic link I get the following error in the browser interface (and the website does not load):
image

The issue is with this function:

export function removeFragmentIdentifierFromBrowserLocation() {
const { history } = configure();
history.pushState("", "", currentBrowserLocationWithoutFragmentIdentifier());
}

When I change line 82 from this:
history.pushState("", "", currentBrowserLocationWithoutFragmentIdentifier());
to this:
history.pushState(null, "", currentBrowserLocationWithoutFragmentIdentifier());

then the Magic Link works perfectly, with no errors.

This is because Next.js expects the first parameter of history.pushState to be either an object or a null value, not an empty string.

It would be great to have the npm package updated so I don't have to maintain my own fork of the code just for this small change.
However, I don't know if this change could have a negative impact when using other frontend frameworks.

By the way, congratulations on creating this really useful project, with excellent documentation. Huge credit is deserved.

@ottokruse
Copy link
Contributor

By the way, congratulations on creating this really useful project, with excellent documentation. Huge credit is deserved.

Thanks mate!

If using null is fine on web as well (haven't looked into it yet) we can add it to the codebase here.

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

No branches or pull requests

2 participants