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

fix(clerk-js): Use the correct returnBack url when GoogleOneTap remains open across navigations #3410

Merged
merged 6 commits into from
May 27, 2024

Conversation

panteliselef
Copy link
Member

@panteliselef panteliselef commented May 21, 2024

Description

Bug fix: Use the correct returnBack url when GoogleOneTap remains open across navigations.
Previously it will only use the url that existed in the browser url bar at the time the component was initially rendered.

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Copy link

changeset-bot bot commented May 21, 2024

🦋 Changeset detected

Latest commit: c38d85c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@clerk/clerk-js Patch
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

},
navigate,
);
await clerk.handleGoogleOneTapCallback(res, ctx.generateCallbackUrls(window.location.href), navigate);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❗️I couldn't find a robust way to listen to url changes (history) so i went with the synchronous solution to pass the current url when the callback runs

Copy link
Contributor

@desiprisg desiprisg May 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do something like:

window.history.pushState = new Proxy(window.history.pushState, {
  apply: (target, thisArg, argArray) => {
    // trigger here what you need
    return target.apply(thisArg, argArray);
  },
});

and make a useCurrentLocation hook or something?

@panteliselef panteliselef self-assigned this May 21, 2024
Copy link
Contributor

@desiprisg desiprisg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good but let's try to do it with a proxy on pushState and see if that simplifies things?!

@panteliselef
Copy link
Member Author

We will attempt to find another solution in another PR

@panteliselef panteliselef enabled auto-merge (squash) May 23, 2024 11:50
@panteliselef panteliselef merged commit f4034ea into main May 27, 2024
11 checks passed
@panteliselef panteliselef deleted the elef/fix-return-back-url branch May 27, 2024 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants