Skip to content

chore: redirect ai agent user to app with carbon modal open#39999

Closed
jsartisan wants to merge 1 commit intoreleasefrom
chore/integrate-new-user-flow
Closed

chore: redirect ai agent user to app with carbon modal open#39999
jsartisan wants to merge 1 commit intoreleasefrom
chore/integrate-new-user-flow

Conversation

@jsartisan
Copy link
Contributor

@jsartisan jsartisan commented Apr 1, 2025

/ok-to-test tags="@tag.Sanity"

This is the corresponding CE PR for redirecting ai agent new user to app page directly.

Summary by CodeRabbit

  • New Features

    • Introduced an AI-driven option during signup that tailors the post-signup experience.
  • Refactor

    • Streamlined the redirection process by consolidating multiple options into a single, structured input.
    • Simplified the logic behind directing users to their respective landing pages for a smoother transition.

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/14189262440
Commit: 03c954c
Cypress dashboard.
Tags: @tag.Sanity
Spec:


Tue, 01 Apr 2025 07:46:41 UTC

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 1, 2025

Walkthrough

The changes update the user redirection functionality. The redirectUserAfterSignup function in the signup helpers now accepts a single object parameter based on a new interface. Unused imports and redundant conditional logic have been removed to simplify the control flow. In the signup success page, a new selector for the AI agent flow is introduced, and its value is passed to the refactored redirect function.

Changes

File(s) Change Summary
app/client/src/ce/.../signupHelpers.ts Changed redirectUserAfterSignup to accept a single object of type RedirectUserAfterSignupProps; removed unused import firstTimeUserOnboardingInit; simplified conditional logic and dispatch flow.
app/client/src/pages/setup/SignupSuccess.tsx Introduced a new selector getIsAiAgentFlowEnabled replacing isNonInvitedUser; updated the call to redirectUserAfterSignup to pass an object including the isAiAgentFlowEnabled value.

Sequence Diagram(s)

sequenceDiagram
    participant SS as SignupSuccess
    participant RU as redirectUserAfterSignup
    participant D as Dispatch
    participant H as History

    SS->>RU: Call redirectUserAfterSignup({redirectUrl, shouldEnableFirstTimeUserOnboarding, validLicense, dispatch, isAiAgentFlowEnabled})
    RU->>D: dispatch(setCurrentApplicationIdForCreateNewApp) [if base IDs provided]
    RU->>H: history.replace(APPLICATIONS_URL)
Loading

Possibly related PRs

Suggested labels

skip-changelog, ok-to-test

Suggested reviewers

  • KelvinOm
  • ashit-rath

Poem

In the code's quiet night, changes gleam bright,
Refined flows dancing in the soft light.
Imports removed and paths aligned,
A seamless flow now clearly defined.
Cheers to cleaner code, a coder's delight!
🚀✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Apr 1, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
app/client/src/ce/utils/signupHelpers.ts (1)

60-66: Update comment to reflect current implementation

The comment still references firstTimeUserOnboardingInit but that import and functionality has been removed.

 /** ! Dev Note:
-  *  setCurrentApplicationIdForCreateNewApp & firstTimeUserOnboardingInit
+  *  setCurrentApplicationIdForCreateNewApp
  *  in the following block support only applicationId
  *  but since baseId and id are same for applications created outside git context
  *  and since these redux actions are only called during onboarding,
  *  passing baseApplicationId as applicationId should be fine
  * **/
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 15d7444 and 03c954c.

📒 Files selected for processing (2)
  • app/client/src/ce/utils/signupHelpers.ts (3 hunks)
  • app/client/src/pages/setup/SignupSuccess.tsx (2 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
app/client/src/pages/setup/SignupSuccess.tsx (1)
app/client/src/ce/utils/signupHelpers.ts (1)
  • redirectUserAfterSignup (29-94)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-build / client-build
  • GitHub Check: client-prettier / prettier-check
🔇 Additional comments (6)
app/client/src/pages/setup/SignupSuccess.tsx (2)

15-15: New selector import for AI agent flow

This import adds the capability to detect if the AI agent flow is enabled, which is now used in the redirection logic.


31-31: Added state for AI agent flow detection

Good addition to capture whether the AI agent flow is enabled via the selector.

app/client/src/ce/utils/signupHelpers.ts (4)

1-1: Removed unused import

Removed unused import for firstTimeUserOnboardingInit while keeping setCurrentApplicationIdForCreateNewApp.


19-20: Added type import for Redux dispatch

Good practice to properly type the dispatch function using the Redux Dispatch type.


21-27: Added interface for function parameters

Good refactoring to create a typed interface for the function parameters, which improves maintainability and type safety.


68-71: Simplified redirection logic

The conditional logic checking for isEnabledForCreateNew has been removed, and the code now directly dispatches the action and redirects to Applications URL. This aligns with the PR objective to streamline navigation.

Comment on lines +35 to +41
redirectUserAfterSignup({
redirectUrl,
shouldEnableFirstTimeUserOnboarding,
validLicense,
dispatch,
isNonInvitedUser,
),
isAiAgentFlowEnabled,
}),
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Updated function call to use object parameter

The function call has been updated to use an object parameter which improves maintainability. However, the dependency array is empty which could lead to stale values if the dependencies change.

Consider adding the dependencies to the array:

  const redirectUsingQueryParam = useCallback(
    () =>
      redirectUserAfterSignup({
        redirectUrl,
        shouldEnableFirstTimeUserOnboarding,
        validLicense,
        dispatch,
        isAiAgentFlowEnabled,
      }),
-    [],
+    [redirectUrl, shouldEnableFirstTimeUserOnboarding, validLicense, dispatch, isAiAgentFlowEnabled],
  );
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
redirectUserAfterSignup({
redirectUrl,
shouldEnableFirstTimeUserOnboarding,
validLicense,
dispatch,
isNonInvitedUser,
),
isAiAgentFlowEnabled,
}),
const redirectUsingQueryParam = useCallback(
() =>
redirectUserAfterSignup({
redirectUrl,
shouldEnableFirstTimeUserOnboarding,
validLicense,
dispatch,
isAiAgentFlowEnabled,
}),
[redirectUrl, shouldEnableFirstTimeUserOnboarding, validLicense, dispatch, isAiAgentFlowEnabled],
);

Comment on lines 29 to +33
export const redirectUserAfterSignup = (
redirectUrl: string,
shouldEnableFirstTimeUserOnboarding: string | null,
_validLicense?: boolean,
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
dispatch?: any,
isEnabledForCreateNew?: boolean, // is Enabled for only non-invited users
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
): any => {
props: RedirectUserAfterSignupProps,
) => {
const { dispatch, redirectUrl, shouldEnableFirstTimeUserOnboarding } = props;

Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Updated function signature to use interface

The function now accepts a single object parameter with a defined interface. However, isAiAgentFlowEnabled is defined in the interface but not used in the function body.


🏁 Script executed:

#!/bin/bash
# Check if isAiAgentFlowEnabled is being used elsewhere in the codebase

echo "Searching for isAiAgentFlowEnabled usage..."
rg "isAiAgentFlowEnabled" --type ts

Length of output: 1301


Action Required: Address the Unused Parameter in Signup Helpers

In the updated function signature for redirectUserAfterSignup, the interface now includes the isAiAgentFlowEnabled property. However, this property isn’t being utilized within the function body. Please either remove isAiAgentFlowEnabled from the RedirectUserAfterSignupProps interface if it isn’t needed in this context, or update the function logic to incorporate it appropriately if it's intended to affect the redirection behavior.

  • File: app/client/src/ce/utils/signupHelpers.ts (Lines 29-33)
  • Suggestion: Remove the unused parameter from the interface or integrate it into the function's logic.

@jsartisan jsartisan added the ok-to-test Required label for CI label Apr 1, 2025
@jsartisan jsartisan closed this Apr 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant