Skip to content

chore: git mod - fixes toast issues#39140

Merged
brayn003 merged 2 commits intoreleasefrom
chore/git-mod-fixes-4
Feb 10, 2025
Merged

chore: git mod - fixes toast issues#39140
brayn003 merged 2 commits intoreleasefrom
chore/git-mod-fixes-4

Conversation

@brayn003
Copy link
Contributor

@brayn003 brayn003 commented Feb 8, 2025

Description

Fixes issue with missing success toast related to git

Fixes #38872
Fixes #38862

Automation

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

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13216997415
Commit: 95ccaed
Cypress dashboard.
Tags: @tag.Git
Spec:


Sat, 08 Feb 2025 17:43:52 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • New Features
    • Discard operations now display clear, contextual success messages to enhance user feedback.
    • Toast notifications have been added for pull actions and protected branch updates, providing real-time confirmation of successful operations.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 8, 2025

Walkthrough

This pull request updates the discard functionality by changing its signature across components, hooks, sagas, and actions to require a success message string parameter. The changes modify how the discard operation is invoked and how success feedback is communicated through toast notifications. Additionally, the pull and protected branch update sagas now include toast displays that conditionally use the provided success message.

Changes

Files Change Summary
app/.../OpsModal/TabDeploy/TabDeployView.tsx, app/.../QuickActions/QuickActionsView.tsx Updated the discard function signature in component props to accept a successMessage argument and modified its calls to pass a generated message.
app/.../hooks/useDiscard.ts, app/.../store/actions/discardActions.ts Modified the discard function and payload interface to include an additional successMessage parameter.
app/.../sagas/discardSaga.ts, app/.../sagas/pullSaga.ts, app/.../sagas/updateProtectedBranchesSaga.ts Revised saga handlers to consume the successMessage from actions and display toast notifications accordingly; added new toast notifications in pull and branch update flows.

Sequence Diagram(s)

sequenceDiagram
    participant C as Component
    participant H as useDiscard
    participant S as DiscardSaga
    participant T as Toast
    C->>H: call discard(successMessage)
    H->>S: dispatch discardInit(successMessage)
    S->>T: if successMessage provided, toast.show(successMessage)
Loading
sequenceDiagram
    participant PC as Pull Component
    participant PS as PullSaga
    participant T as Toast
    PC->>PS: initiate pull request
    PS->>T: toast.show(createMessage(DISCARD_AND_PULL_SUCCESS))
Loading

Assessment against linked issues

Objective Addressed Explanation
Correct toast message for pulling remote changes on a protected branch (#38872)
Responsive branch selection dropdown for merging (#38594) No changes were made to the dropdown responsiveness logic.

Possibly related PRs

Suggested labels

Bug, Enhancement, Git Product, ok-to-test, Release, Needs Triaging

Suggested reviewers

  • ashit-rath

Poem

In lines of code a change takes flight,
A new success message shines so bright.
Discard now sings with words precise,
Toasts now cheer, no need for vice.
Code flows anew with message in hand—
Onward we code, united we stand!

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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 Bug Something isn't working Git Product Issues related to version control product Medium Issues that frustrate users due to poor UX Needs Triaging Needs attention from maintainers to triage Packages & Git Pod All issues belonging to Packages and Git Production QA Needs QA attention Release labels Feb 8, 2025
@brayn003 brayn003 changed the title Chore/git mod fixes 4 chore: git mod - fixes toast issues Feb 8, 2025
@github-actions github-actions bot removed the Bug Something isn't working label Feb 8, 2025
@brayn003 brayn003 added the ok-to-test Required label for CI label Feb 8, 2025
@github-actions github-actions bot added Bug Something isn't working skip-changelog Adding this label to a PR prevents it from being listed in the changelog and removed Bug Something isn't working labels Feb 8, 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: 0

🧹 Nitpick comments (1)
app/client/src/git/sagas/pullSaga.ts (1)

60-74: Consider adding error toast notifications for consistency.

While success cases show toast notifications, error cases only log to console and Sentry. Consider adding error toast notifications for better user feedback.

 } catch (e) {
   if (response && response.responseMeta.error) {
     const { error } = response.responseMeta;
     yield put(gitArtifactActions.pullError({ artifactDef, error }));
+    toast.show(error.message || "Pull failed", {
+      kind: "error",
+    });
   } else {
     log.error(e);
     captureException(e);
+    toast.show("Failed to pull changes", {
+      kind: "error",
+    });
   }
 }
🧰 Tools
🪛 Biome (1.9.4)

[error] 61-61: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 29b571e and 95ccaed.

📒 Files selected for processing (7)
  • app/client/src/git/components/OpsModal/TabDeploy/TabDeployView.tsx (2 hunks)
  • app/client/src/git/components/QuickActions/QuickActionsView.tsx (3 hunks)
  • app/client/src/git/hooks/useDiscard.ts (1 hunks)
  • app/client/src/git/sagas/discardSaga.ts (2 hunks)
  • app/client/src/git/sagas/pullSaga.ts (2 hunks)
  • app/client/src/git/sagas/updateProtectedBranchesSaga.ts (2 hunks)
  • app/client/src/git/store/actions/discardActions.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-build / client-build
  • GitHub Check: client-prettier / prettier-check
🔇 Additional comments (11)
app/client/src/git/sagas/pullSaga.ts (2)

17-18: LGTM! Import statements are well-organized.

The new imports for toast notifications are correctly placed and follow project conventions.


56-58: Verify the message constant usage.

The saga is named pullSaga but uses DISCARD_AND_PULL_SUCCESS message constant. Please verify if this is the intended message for a regular pull operation or if a different message constant should be used.

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Search for other usages of DISCARD_AND_PULL_SUCCESS to understand the context
rg "DISCARD_AND_PULL_SUCCESS" -A 5

Length of output: 3523


Message constant usage verified

The constant DISCARD_AND_PULL_SUCCESS is defined as returning "Pulled from remote successfully" and is used consistently across both pullSaga and other components like QuickActionsView. Despite its name suggesting a "discard and pull" action, its message accurately reflects a successful pull operation. No changes are needed here.

app/client/src/git/store/actions/discardActions.ts (1)

7-10: LGTM! Clean interface extension.

The optional successMessage property is well-integrated into the existing interface.

app/client/src/git/hooks/useDiscard.ts (1)

15-28: LGTM! Clean hook implementation.

The useCallback implementation correctly handles the new successMessage parameter and includes all necessary dependencies.

app/client/src/git/sagas/discardSaga.ts (1)

17-40: LGTM! Well-structured toast implementation.

The conditional toast display is properly placed before the reload delay, ensuring user visibility.

app/client/src/git/sagas/updateProtectedBranchesSaga.ts (1)

1-3: LGTM! Consistent toast implementation.

The success notification follows the established pattern and is properly placed after the success actions.

Also applies to: 47-49

app/client/src/git/components/QuickActions/QuickActionsView.tsx (3)

8-8: LGTM!

The import is correctly added and used in the component.


109-109: LGTM!

The success message is correctly passed to the discard function.


31-31: Breaking change: Verify parent components.

The discard prop type now requires a success message parameter.

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Find all components that pass the discard prop to QuickActionsView
ast-grep --pattern 'discard={$_}'

Length of output: 35


I'll run a new shell script to search for instances where QuickActionsView is used with the discard prop. This should help verify whether the parent components provide the required parameter.


🏁 Script executed:

#!/bin/bash
echo "Searching for QuickActionsView usage with discard prop..."
rg --heading --line-number "<QuickActionsView[^>]*discard=" || echo "No matches found."

Length of output: 231


Breaking Change Verification:
The new discard prop now requires a success message parameter. Our search for QuickActionsView usages with a discard prop did not reveal any instances, which suggests that no parent components are currently passing this prop incorrectly. Please ensure that any indirect invocations or dynamic prop assignments are manually verified to cover all cases.

app/client/src/git/components/OpsModal/TabDeploy/TabDeployView.tsx (2)

242-242: LGTM!

The success message is correctly passed to the discard function.


78-78: 🏁 Script executed:

#!/bin/bash
# Find all components that pass the discard prop to TabDeployView
ast-grep --pattern 'discard={$_}'

Length of output: 35

@brayn003 brayn003 self-assigned this Feb 8, 2025
@brayn003 brayn003 requested a review from ashit-rath February 8, 2025 15:41
@github-actions github-actions bot added Bug Something isn't working and removed Bug Something isn't working labels Feb 8, 2025
@brayn003 brayn003 merged commit d199546 into release Feb 10, 2025
52 checks passed
@brayn003 brayn003 deleted the chore/git-mod-fixes-4 branch February 10, 2025 08:59
@brayn003 brayn003 mentioned this pull request Feb 10, 2025
2 tasks
trishaanand pushed a commit that referenced this pull request Feb 11, 2025
## Description
Discard toast issue, introduced in
#39140

## Automation

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

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!CAUTION]
> 🔴 🔴 🔴 Some tests have failed.
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/13240898404>
> Commit: f8e760a
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13240898404&attempt=4&selectiontype=test&testsstatus=failed&specsstatus=fail"
target="_blank">Cypress dashboard</a>.
> Tags: @tag.Git
> Spec: 
> The following are new failures, please fix them before merging the PR:
<ol>
> <li>cypress/e2e/Regression/ServerSide/QueryPane/Mongo1_spec.ts</ol>
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/identified-flaky-tests-65890b3c81d7400d08fa9ee3?branch=master"
target="_blank">List of identified flaky tests</a>.
> <hr>Mon, 10 Feb 2025 22:21:53 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Updated the discard confirmation so users now receive a clear success
notification, ensuring more accurate feedback when changes are
discarded.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Feb 12, 2025
## Description
Fixes issue with missing success toast related to git

Fixes appsmithorg#38872
Fixes appsmithorg#38862

## Automation
/ok-to-test tags="@tag.Git"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/13216997415>
> Commit: 95ccaed
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13216997415&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Git`
> Spec:
> <hr>Sat, 08 Feb 2025 17:43:52 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- New Features  
- Discard operations now display clear, contextual success messages to
enhance user feedback.
- Toast notifications have been added for pull actions and protected
branch updates, providing real-time confirmation of successful
operations.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Feb 12, 2025
## Description
Discard toast issue, introduced in
appsmithorg#39140

## Automation

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

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!CAUTION]
> 🔴 🔴 🔴 Some tests have failed.
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/13240898404>
> Commit: f8e760a
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13240898404&attempt=4&selectiontype=test&testsstatus=failed&specsstatus=fail"
target="_blank">Cypress dashboard</a>.
> Tags: @tag.Git
> Spec: 
> The following are new failures, please fix them before merging the PR:
<ol>
> <li>cypress/e2e/Regression/ServerSide/QueryPane/Mongo1_spec.ts</ol>
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/identified-flaky-tests-65890b3c81d7400d08fa9ee3?branch=master"
target="_blank">List of identified flaky tests</a>.
> <hr>Mon, 10 Feb 2025 22:21:53 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Updated the discard confirmation so users now receive a clear success
notification, ensuring more accurate feedback when changes are
discarded.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@coderabbitai coderabbitai bot mentioned this pull request Feb 15, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Git Product Issues related to version control product Medium Issues that frustrate users due to poor UX Needs Triaging Needs attention from maintainers to triage ok-to-test Required label for CI Packages & Git Pod All issues belonging to Packages and Git Production QA Needs QA attention Release skip-changelog Adding this label to a PR prevents it from being listed in the changelog

Projects

None yet

2 participants