Skip to content

Conversation

@panteliselef
Copy link
Member

@panteliselef panteliselef commented Feb 3, 2025

Description

On keyless avoid infinite redirect loop when page does not exist and application is attempting to sync state with middleware.

Before

Screen.Recording.2025-02-03.at.6.04.01.PM.mov

After

Screen.Recording.2025-02-03.at.6.02.37.PM.mov

Checklist

  • pnpm test runs as expected.
  • pnpm 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:

@vercel
Copy link

vercel bot commented Feb 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clerk-js-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 3, 2025 6:25pm

@changeset-bot
Copy link

changeset-bot bot commented Feb 3, 2025

🦋 Changeset detected

Latest commit: 4c83ad6

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

This PR includes changesets to release 1 package
Name Type
@clerk/nextjs 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

@panteliselef panteliselef requested a review from a team February 3, 2025 16:16
@panteliselef panteliselef self-assigned this Feb 3, 2025
const detectedMiddelware = detectClerkMiddleware(request);

/**
* Prevents infinite redirects in when the `returnUrl` will result to a 404 (not-found) page.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Prevents infinite redirects in when the `returnUrl` will result to a 404 (not-found) page.
* Prevents infinite redirects when the `returnUrl` will result to a 404 (not-found) page.

Copy link
Member

@brkalow brkalow left a comment

Choose a reason for hiding this comment

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

Let's find a different approach that checks the data we're trying to sync

Copy link
Member

@brkalow brkalow left a comment

Choose a reason for hiding this comment

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

👏

@panteliselef panteliselef merged commit 573ed86 into main Feb 3, 2025
29 checks passed
@panteliselef panteliselef deleted the elef/actls-81-fix-infinite-redirect-when-visiting-not-found branch February 3, 2025 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants