- 
                Notifications
    You must be signed in to change notification settings 
- Fork 851
(Do not merge) Document <RedirectToTasks /> component #2730
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
          
     Open
      
      
            SarahSoutoul
  wants to merge
  9
  commits into
  main
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
ss/DOCS-11025
  
      
      
   
  
    
  
  
  
 
  
      
    base: main
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Open
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            9 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      9f478ca
              
                Add initial info
              
              
                SarahSoutoul 35d1948
              
                Refine code examples
              
              
                SarahSoutoul 5f5a54c
              
                Fix linting
              
              
                SarahSoutoul a7718c3
              
                Merge branch 'main' into ss/DOCS-11025
              
              
                SarahSoutoul 4f24515
              
                Merge branch 'main' into ss/DOCS-11025
              
              
                SarahSoutoul 4a81a84
              
                Refine text + fix redirect create org description
              
              
                SarahSoutoul 3c4e803
              
                Update docs/reference/components/control/redirect-to-tasks.mdx
              
              
                SarahSoutoul ce47607
              
                Fix spacing
              
              
                SarahSoutoul c7f6c6d
              
                Add chrome extension example
              
              
                SarahSoutoul File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
  
    
      
          
            2 changes: 1 addition & 1 deletion
          
          2 
        
  docs/reference/components/control/redirect-to-create-organization.mdx
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
  
    
      
          
            142 changes: 142 additions & 0 deletions
          
          142 
        
  docs/reference/components/control/redirect-to-tasks.mdx
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| --- | ||
| title: '`<RedirectToTasks />`' | ||
| description: The <RedirectToTasks /> component will navigate to the tasks flow which has been configured in your application instance when users have pending session tasks. The behavior will be just like a server-side (3xx) redirect, and will override the current location in the history stack. | ||
| sdk: chrome-extension, nextjs, nuxt, react, react-router, remix, tanstack-react-start, vue | ||
| --- | ||
|  | ||
| The `<RedirectToTasks />` component will navigate to the tasks flow which has been configured in your application instance when users have pending session tasks. The behavior will be just like a server-side (3xx) redirect, and will override the current location in the history stack. [See the guide on creating custom pages for sessions tasks](/docs/guides/development/custom-flows/overview#session-tasks). | ||
|  | ||
| ## Example | ||
|  | ||
| <If sdk="nextjs"> | ||
| ```tsx {{ filename: 'app/layout.tsx' }} | ||
| import { SignedOut, RedirectToTasks } from '@clerk/nextjs' | ||
|  | ||
| export default function Layout({ children }: { children: React.ReactNode }) { | ||
| return ( | ||
| <> | ||
| <SignedOut> | ||
| <RedirectToTasks /> | ||
| </SignedOut> | ||
| {children} | ||
| </> | ||
| ) | ||
| } | ||
| ``` | ||
| </If> | ||
|  | ||
| <If sdk="react"> | ||
| ```tsx {{ filename: 'pages/index.tsx' }} | ||
| import { SignedOut, RedirectToTasks } from '@clerk/clerk-react' | ||
|  | ||
| export default function Page() { | ||
| return ( | ||
| <> | ||
| <SignedOut> | ||
| <RedirectToTasks /> | ||
| </SignedOut> | ||
| </> | ||
| ) | ||
| } | ||
| ``` | ||
| </If> | ||
|  | ||
| <If sdk="react-router"> | ||
| ```tsx {{ filename: 'app/routes/home.tsx' }} | ||
| import { SignedOut, RedirectToTasks } from '@clerk/react-router' | ||
|  | ||
| export default function Home() { | ||
| return ( | ||
| <> | ||
| <SignedOut> | ||
| <RedirectToTasks /> | ||
| </SignedOut> | ||
| </> | ||
| ) | ||
| } | ||
| ``` | ||
| </If> | ||
|  | ||
| <If sdk="chrome-extension"> | ||
| > [!NOTE] | ||
| > This component relies on React Router for navigation. Ensure that you have integrated React Router into your Chrome Extension application before using it. [Learn how to add React Router to your Chrome Extension](/docs/guides/development/add-react-router). | ||
|  | ||
| ```jsx {{ filename: 'src/routes/home.tsx' }} | ||
| import { SignedOut, RedirectToTasks } from '@clerk/chrome-extension' | ||
|  | ||
| export default function Home() { | ||
| return ( | ||
| <> | ||
| <SignedOut> | ||
| <RedirectToTasks /> | ||
| </SignedOut> | ||
| </> | ||
| ) | ||
| } | ||
| ``` | ||
| </If> | ||
|  | ||
| <If sdk="remix"> | ||
| ```tsx {{ filename: 'app/routes/_index.tsx' }} | ||
| import { SignedOut, RedirectToTasks } from '@clerk/remix' | ||
|  | ||
| export default function Index() { | ||
| return ( | ||
| <div> | ||
| <SignedOut> | ||
| <RedirectToTasks /> | ||
| </SignedOut> | ||
| </div> | ||
| ) | ||
| } | ||
| ``` | ||
| </If> | ||
|  | ||
| <If sdk="tanstack-react-start"> | ||
| ```tsx {{ filename: 'app/routes/index.tsx' }} | ||
| import { SignedOut, RedirectToTasks } from '@clerk/tanstack-react-start' | ||
| import { createFileRoute } from '@tanstack/react-router' | ||
|  | ||
| export const Route = createFileRoute('/')({ | ||
| component: Home, | ||
| }) | ||
|  | ||
| function Home() { | ||
| return ( | ||
| <div> | ||
| <SignedOut> | ||
| <RedirectToTasks /> | ||
| </SignedOut> | ||
| </div> | ||
| ) | ||
| } | ||
| ``` | ||
| </If> | ||
|  | ||
| <If sdk="vue"> | ||
| ```vue {{ filename: 'App.vue' }} | ||
| <script setup lang="ts"> | ||
| import { SignedOut, RedirectToTasks } from '@clerk/vue' | ||
| </script> | ||
|  | ||
| <template> | ||
| <SignedOut> | ||
| <RedirectToTasks /> | ||
| </SignedOut> | ||
| </template> | ||
| ``` | ||
| </If> | ||
|  | ||
| <If sdk="nuxt"> | ||
| ```vue {{ filename: 'App.vue' }} | ||
| <script setup lang="ts"> | ||
| // Components are automatically imported | ||
| </script> | ||
|  | ||
| <template> | ||
| <SignedOut> | ||
| <RedirectToTasks /> | ||
| </SignedOut> | ||
| </template> | ||
| ``` | ||
| </If> | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing a chrome extension example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added here: Add chrome extension example