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: transfer return to url between flows #326

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jonas-jonas
Copy link
Member

Related Issue or Design Document

Checklist

  • I have read the contributing guidelines and signed the CLA.
  • I have referenced an issue containing the design document if my change introduces a new feature.
  • I have read the security policy.
  • I confirm that this pull request does not address a security vulnerability.
    If this pull request addresses a security vulnerability,
    I confirm that I got approval (please contact [email protected]) from the maintainers to push the changes.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added the necessary documentation within the code base (if appropriate).

Further comments

@jonas-jonas jonas-jonas self-assigned this Jan 10, 2025
@aeneasr
Copy link
Member

aeneasr commented Jan 10, 2025

I'm not sure, but you might be doing work that i'm currently doing / have already done (which is fixing a lot of these edge cases): #321

const initFlowUrl = useCallback(
(flowType: FlowType) => {
let query = ""
if (flowContainer.flow.request_url) {
Copy link
Member

Choose a reason for hiding this comment

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

The request_url and the flow type can differ here. For example, you call initFlowUrl() of Login but you are currently in a registration flow. Taking the query params from e.g. login to registration may or may not cause issues (e.g. using a parameter that doesn't exist or with an invalid value).

You can check on the PR I made - utils/urls.ts where we have initFlowUrl (usually for transitions) and restartFlowUrl (to restart the flow with the same params).

I think it's good to expose both variants to users as they're quite useful

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, true.

This helper was just intended to transfer the return to (to preserve oauth context, etc.).

None of the functions in utils/urls.ts are exposed at the moment, though.

Copy link
Member

Choose a reason for hiding this comment

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

This helper was just intended to transfer the return to (to preserve oauth context, etc.).

Understood, just wanted to highlight the difference in case you decide to port these changes over.

None of the functions in utils/urls.ts are exposed at the moment, though.

I often do that on purpose because "when in doubt leave it out" - if no-one is asking for them to be exported we shouldn't export it, because it makes it more difficult to do changes later on. I do agree though that those are helpful functions to have

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