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(adapter-nextjs): wrong use of nullish coalescing #14112

Merged
merged 1 commit into from
Jan 6, 2025

Conversation

HuiSF
Copy link
Member

@HuiSF HuiSF commented Jan 3, 2025

Description of changes

Remove wrong usage of nullish coalescing.

Issue #, if available

Description of how you validated changes

  • unit tests

Checklist

  • PR description included
  • yarn test passes
  • Unit Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

Checklist for repo maintainers

  • Verify E2E tests for existing workflows are working as expected or add E2E tests for newly added workflows
  • New source file paths included in this PR have been added to CODEOWNERS, if appropriate

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link
Member

@AllanZhengYP AllanZhengYP left a comment

Choose a reason for hiding this comment

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

Nice catch!

describe('getRedirectOrDefault', () => {
test.each([
[undefined, '/'],
['', '/'],
Copy link
Member

Choose a reason for hiding this comment

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

when will empty string be an issue? won't the redirectURL be undefined or expected to be valid?

Copy link
Member Author

@HuiSF HuiSF Jan 6, 2025

Choose a reason for hiding this comment

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

Empty string is not a valid URI to redirect to. This supplier of the value is the redirectOnSignInComplete and redirectOnSignOutComplete parameters on the public API, they are requiring a string value, so empty string is allowed. As it's not a valid URI so we fallback to the root here, as if it's undefined.

Base automatically changed from hui/feat/adapter-nextjs/7-use-max-age to feat/server-auth/main January 6, 2025 22:21
@HuiSF HuiSF requested a review from a team as a code owner January 6, 2025 22:21
@HuiSF HuiSF force-pushed the hui/fix/8-fix-wrong-use-coalescing branch from df2aa27 to 59585f0 Compare January 6, 2025 22:28
@HuiSF HuiSF merged commit f8d978b into feat/server-auth/main Jan 6, 2025
28 checks passed
@HuiSF HuiSF deleted the hui/fix/8-fix-wrong-use-coalescing branch January 6, 2025 22:37
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.

5 participants