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

chore: git tag - fixing contracts for pretag #39581

Open
wants to merge 11 commits into
base: release
Choose a base branch
from
Open

Conversation

brayn003
Copy link
Contributor

@brayn003 brayn003 commented Mar 5, 2025

Description

  • Updates api contracts for pretag validation in release tab

Fixes #38808

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/13706138270
Commit: 08cad2f
Cypress dashboard.
Tags: @tag.Git
Spec:


Thu, 06 Mar 2025 19:58:32 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Introduced a new TabRelease component for managing pre-tagging functionality.
    • Added a custom hook usePretag for improved data management related to pre-tagging.
    • Implemented a new useReleaseTag hook for handling release tag creation.
    • Enhanced OpsModalView to conditionally render tagging capabilities based on artifact definition.
    • Added a new isGitTaggingEnabled function to determine if tagging is applicable based on artifact type.
  • Bug Fixes

    • Updated components to utilize the new pre-tagging data structure, ensuring accurate information is displayed.
    • Improved display logic in LatestCommitInfoView for commit messages and author information.
  • Refactor

    • Removed outdated commit-related actions and state management, transitioning to pre-tagging actions and state.
    • Modified selectors to focus on pre-tagging data instead of the latest commit state.
    • Renamed and restructured components for clarity and consistency in handling pre-tagging and release tagging.
  • Style

    • Updated the TAB_RELEASE property for improved display consistency.

@brayn003 brayn003 self-assigned this Mar 5, 2025
Copy link
Contributor

coderabbitai bot commented Mar 5, 2025

Warning

Rate limit exceeded

@brayn003 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 0 minutes and 40 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 5f0a984 and 08cad2f.

📒 Files selected for processing (2)
  • app/client/src/git/components/LatestCommitInfo/LatestCommitInfoView.test.tsx (5 hunks)
  • app/client/src/git/components/ReleaseVersionRadioGroup/ReleaseVersionRadioGroupView.test.tsx (2 hunks)

Walkthrough

This pull request migrates commit data fetching from the old "latestCommit" mechanism to a new "pretag" system. It updates multiple React components to use the usePretag hook, renames and refactors components (e.g., TabRelease to TabReleaseView), and adjusts Redux actions, slices, selectors, and TypeScript types accordingly. Deprecated files and types related to the previous hook are removed, while new actions, request signatures, and types for handling pretag data are introduced.

Changes

File(s) Change Summary
app/client/src/git/components/LatestCommitInfo/index.tsx
app/client/src/git/components/ReleaseVersionRadioGroup/index.tsx
Replaced hook usage from useLatestCommit to usePretag and updated variable references (e.g., latestCommitpretagResponse).
app/client/src/git/components/OpsModal/TabRelease/TabReleaseView.tsx
app/client/src/git/components/OpsModal/TabRelease/index.tsx
Renamed component to TabReleaseView; introduced new TabReleaseProps with a fetchPretag prop; added a lifecycle hook to call fetchPretag and wrapped with a new TabRelease component connecting to usePretag.
app/client/src/git/hooks/useLatestCommit.ts Deleted obsolete hook for fetching commit data.
app/client/src/git/hooks/usePretag.ts Added a new hook to manage pretag data using Git context and Redux dispatch.
app/client/src/git/requests/fetchLatestCommitRequest.types.ts Removed outdated type definitions for latest commit responses.
app/client/src/git/requests/pretagRequest.ts
app/client/src/git/requests/pretagRequest.types.ts
Updated the exported function to pretagRequest with a new response type (PretagResponse); added new type definitions for pretag responses.
app/client/src/git/store/actions/fetchLatestCommitActions.ts Removed old commit actions and associated TypeScript types.
app/client/src/git/store/actions/pretagActions.ts Introduced new actions: pretagInitAction, pretagSuccessAction, and pretagErrorAction for handling pretag operations.
app/client/src/git/store/gitArtifactSlice.ts
app/client/src/git/store/helpers/initialState.ts
app/client/src/git/store/selectors/gitArtifactSelectors.ts
app/client/src/git/store/types.ts
Updated Redux slice, initial state, selectors, and types to replace commit-related state with pretag state.

Sequence Diagram(s)

sequenceDiagram
    participant C as TabRelease Component
    participant H as usePretag Hook
    participant A as Redux Actions
    participant API as pretagRequest API
    participant S as Redux Store

    C->>H: Invoke fetchPretag (via useEffect)
    H->>A: Dispatch pretagInitAction
    A->>API: Call pretagRequest()
    API-->>A: Return PretagResponse
    A->>S: Dispatch pretagSuccessAction with response
    S-->>H: Update pretag state
Loading

Possibly related PRs

  • chore: Add IDE Tabs state in Focus Retention #38799: The changes in the main PR, which involve replacing the useLatestCommit hook with usePretag in the LatestCommitInfo component, are related to the changes in the retrieved PR, which also involve the introduction of the usePretag hook and modifications to how data is handled in the context of pre-tagging. Both PRs focus on the transition from handling latest commit data to pre-tagging data, indicating a direct connection at the code level.
  • chore: git tag - ui components for tagging release #39508: The changes in the main PR are related to the modifications in the LatestCommitInfo component, which is also referenced in the retrieved PR that introduces the LatestCommitInfo component, indicating a direct connection at the code level.

Suggested labels

Enhancement

Suggested reviewers

  • ApekshaBhosale
  • sagar-qa007
  • ankitakinger

Poem

In our code a change does gleam,
From "latestCommit" to a "pretag" dream.
Components awaken with a fresh new call,
Redux and hooks now answer the call.
CodeRabbit cheers with a joyful beat,
As our Git flow dances neat! 🎉


🪧 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 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 Git Product Issues related to version control product Packages & Git Pod All issues belonging to Packages and Git Task A simple Todo labels Mar 5, 2025
@brayn003 brayn003 requested a review from ashit-rath March 5, 2025 16:34
@brayn003 brayn003 added the ok-to-test Required label for CI label Mar 5, 2025
@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Mar 5, 2025
@brayn003 brayn003 changed the title chore: fixing contracts for pretag chore: git tag - fixing contracts for pretag Mar 5, 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 (2)
app/client/src/git/components/LatestCommitInfo/index.tsx (1)

10-13: Property access paths updated for new structure.

All property access paths have been correctly updated to match the new pretagResponse structure. Consider adding extra null check for the author property.

-      authorName={pretagResponse?.author.name ?? null}
+      authorName={pretagResponse?.author?.name ?? null}
app/client/src/git/requests/pretagRequest.types.ts (1)

3-15: Interface structure is well-defined.

The PretagResponseData interface clearly defines the expected structure of the pretag response data. Consider adding JSDoc comments for better documentation.

+/**
+ * Represents the data structure of a pretag response
+ */
 export interface PretagResponseData {
+  /**
+   * Author information of the commit
+   */
   author: {
     name: string;
     email: string;
   };
+  /**
+   * ISO timestamp of when the commit was made
+   */
   committedAt: string;
+  /**
+   * Commit hash identifier
+   */
   hash: string;
+  /**
+   * Commit message
+   */
   message: string;

+  /**
+   * Name of the release tag
+   */
   releaseTagName: string;
+  /**
+   * ISO timestamp of when the release was created
+   */
   releasedAt: string;
+  /**
+   * Indicates if the commit can be released
+   */
   isReleasable: boolean;
 }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a619db5 and c0ed0fa.

📒 Files selected for processing (15)
  • app/client/src/git/components/LatestCommitInfo/index.tsx (1 hunks)
  • app/client/src/git/components/OpsModal/TabRelease/TabReleaseView.tsx (3 hunks)
  • app/client/src/git/components/OpsModal/TabRelease/index.tsx (1 hunks)
  • app/client/src/git/components/ReleaseVersionRadioGroup/index.tsx (2 hunks)
  • app/client/src/git/hooks/useLatestCommit.ts (0 hunks)
  • app/client/src/git/hooks/usePretag.ts (1 hunks)
  • app/client/src/git/requests/fetchLatestCommitRequest.types.ts (0 hunks)
  • app/client/src/git/requests/pretagRequest.ts (1 hunks)
  • app/client/src/git/requests/pretagRequest.types.ts (1 hunks)
  • app/client/src/git/store/actions/fetchLatestCommitActions.ts (0 hunks)
  • app/client/src/git/store/actions/pretagActions.ts (1 hunks)
  • app/client/src/git/store/gitArtifactSlice.ts (2 hunks)
  • app/client/src/git/store/helpers/initialState.ts (1 hunks)
  • app/client/src/git/store/selectors/gitArtifactSelectors.ts (1 hunks)
  • app/client/src/git/store/types.ts (2 hunks)
💤 Files with no reviewable changes (3)
  • app/client/src/git/requests/fetchLatestCommitRequest.types.ts
  • app/client/src/git/hooks/useLatestCommit.ts
  • app/client/src/git/store/actions/fetchLatestCommitActions.ts
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: build
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: client-build / client-build
  • GitHub Check: client-lint / client-lint
🔇 Additional comments (26)
app/client/src/git/hooks/usePretag.ts (5)

1-7: Imports are correctly organized.

The imports are well-structured and include all necessary dependencies for the hook functionality.


8-12: Well-structured hook with proper context extraction.

The hook correctly uses the Git context to extract necessary artifact information.


13-14: State selection implemented correctly.

The hook properly uses the selector to retrieve the pretag state from the Redux store.


15-19: Memoized callback with appropriate dependencies.

The fetchPretag function is correctly memoized with useCallback and includes all the necessary dependencies in the dependency array.


21-26: Return object handles null cases properly.

The return object correctly uses the null coalescing operator to provide fallback values when the state properties are undefined.

app/client/src/git/components/OpsModal/TabRelease/index.tsx (3)

1-4: Imports are correctly structured.

The component imports all necessary dependencies including the new usePretag hook.


5-9: Component implementation is concise and focused.

The component has a single responsibility - to connect the pretag functionality to the view component.


11-12: Export is properly defined.

The default export makes the component available for import in other modules.

app/client/src/git/components/LatestCommitInfo/index.tsx (2)

3-3: Import updated to use the new hook.

Correctly updated to use usePretag instead of the previous useLatestCommit hook.


6-6: Destructuring updated for new data structure.

Correctly updated to extract pretagResponse instead of latestCommit.

app/client/src/git/requests/pretagRequest.types.ts (2)

1-2: Import is correctly defined.

The ApiResponse type import is appropriately included.


17-17: Type alias is correctly defined.

The PretagResponse type correctly extends the ApiResponse type with the PretagResponseData interface.

app/client/src/git/components/ReleaseVersionRadioGroup/index.tsx (1)

4-4: Hook migration implementation is correct.

The migration from useLatestCommit to usePretag is properly implemented with appropriate property access updates (releaseTagName, releasedAt). Proper optional chaining and nullish coalescing are used to handle potential undefined values.

Also applies to: 13-13, 17-17, 19-19

app/client/src/git/store/helpers/initialState.ts (1)

132-136: New pretag state initialization looks good.

The new pretag property is correctly added to the state with the standard structure (value, loading, error) and appropriate initial values.

app/client/src/git/components/OpsModal/TabRelease/TabReleaseView.tsx (4)

6-7: Props interface properly defined.

The TabReleaseProps interface is well-defined with the appropriate function signature for fetchPretag.

Also applies to: 25-27


29-29: Renamed component with proper prop destructuring.

The component has been correctly renamed from TabRelease to TabReleaseView with default value handling using noop.


35-40: Appropriate effect hook implementation.

The useEffect is correctly implemented with a descriptive name and proper dependency array to ensure fetchPretag is called on component mount and when the function reference changes.


72-72: Export statement updated correctly.

Export statement properly reflects the new component name.

app/client/src/git/requests/pretagRequest.ts (1)

4-4:

❓ Verification inconclusive

API request function renamed but endpoint unchanged.

The function has been appropriately renamed from fetchLatestCommitRequest to pretagRequest with updated return type. Note that the API endpoint still contains "commit/latest" in the URL - ensure this is aligned with backend expectations.

Also applies to: 8-11


🏁 Script executed:

#!/bin/bash
# Check if there are any references to the endpoint in other files that might need updating
rg -A 2 "commit/latest" --glob "*.{ts,tsx}" | grep -v "pretagRequest.ts"

Length of output: 70


Endpoint Verification: Please confirm backend alignment

The function has been successfully renamed to pretagRequest with the updated return type, but the API URL still includes "commit/latest" (notably around lines 8–11 of app/client/src/git/requests/pretagRequest.ts). Our initial search didn’t reveal other usages of this endpoint, so please manually verify that the backend still expects "commit/latest" for this API call.

  • File: app/client/src/git/requests/pretagRequest.ts (especially lines 8–11)
  • Action: Confirm with backend or update the endpoint as needed to match backend expectations
app/client/src/git/store/selectors/gitArtifactSelectors.ts (1)

91-94: Selector implementation looks good.

New selector correctly retrieves the pretag state from API responses.

app/client/src/git/store/types.ts (2)

22-22: Import statement correctly added.

The new import for PretagResponseData replaces the removed FetchLatestCommitResponseData import.


63-63: Type definition properly updated.

The new pretag property replaces the removed latestCommit property in GitArtifactAPIResponsesReduxState.

app/client/src/git/store/gitArtifactSlice.ts (2)

145-148: Imports correctly updated.

New pretag action imports replace the removed latestCommit actions.


213-215: Reducers properly defined.

New pretag reducers added to replace the removed latestCommit reducers.

app/client/src/git/store/actions/pretagActions.ts (2)

20-27: Success action implementation looks good.

The success action correctly updates the state with the pretag response data.


29-38: Error action implementation is correct.

The error handling is properly implemented to update the state with error information.

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 (3)
app/client/src/git/hooks/useReleaseTag.ts (1)

8-36: Well-structured hook implementation

The hook follows React best practices by using useCallback for memoization and properly setting up dependencies. It handles the release tag creation workflow cleanly.

Consider adding explicit TypeScript return type annotation for this hook to improve type safety and developer experience:

-function useReleaseTag() {
+function useReleaseTag(): {
+  isCreateReleaseTagLoading: boolean;
+  createReleaseTagError: Error | null;
+  createReleaseTag: (params: { tag: string; releaseNote: string; commitSHA: string }) => void;
+} {
app/client/src/git/components/OpsModal/OpsModalView.tsx (1)

63-78: Consider adding analytics logging for the Release tab.

The handleTabKeyChange function logs analytics events for Deploy and Merge tabs, but there's no equivalent logging for the new Release tab. For consistency, consider adding analytics for the Release tab.

if (tabKey === GitOpsTab.Deploy) {
  AnalyticsUtil.logEvent("GS_DEPLOY_GIT_MODAL_TRIGGERED", {
    source: `${tabKey.toUpperCase()}_TAB`,
  });
} else if (tabKey === GitOpsTab.Merge) {
  AnalyticsUtil.logEvent("GS_MERGE_GIT_MODAL_TRIGGERED", {
    source: `${tabKey.toUpperCase()}_TAB`,
  });
+} else if (tabKey === GitOpsTab.Release) {
+  AnalyticsUtil.logEvent("GS_RELEASE_GIT_MODAL_TRIGGERED", {
+    source: `${tabKey.toUpperCase()}_TAB`,
+  });
}
app/client/src/git/components/LatestCommitInfo/LatestCommitInfoView.tsx (1)

28-31: Improve conditional rendering logic for better readability.

The current implementation uses multiple conditional renders which makes the code harder to read. Consider using a more concise approach:

- {authorName && !committedAt ? `Committed by ${authorName}` : null}
- {authorName && committedAt
-   ? `${authorName} committed ${committedAt ?? "-"}`
-   : null}
+ {authorName ? (
+   committedAt 
+     ? `${authorName} committed ${committedAt}` 
+     : `Committed by ${authorName}`
+ ) : null}

This approach consolidates the logic and makes it more maintainable.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 4e8ddf6 and 76266a9.

📒 Files selected for processing (18)
  • app/client/src/git/ce/constants/messages.tsx (1 hunks)
  • app/client/src/git/components/LatestCommitInfo/LatestCommitInfoView.tsx (1 hunks)
  • app/client/src/git/components/LatestCommitInfo/index.tsx (1 hunks)
  • app/client/src/git/components/OpsModal/OpsModalView.tsx (4 hunks)
  • app/client/src/git/components/OpsModal/TabRelease/TabReleaseView.tsx (4 hunks)
  • app/client/src/git/components/OpsModal/TabRelease/index.tsx (1 hunks)
  • app/client/src/git/components/OpsModal/index.tsx (2 hunks)
  • app/client/src/git/components/ReleaseVersionRadioGroup/ReleaseVersionRadioGroupView.tsx (2 hunks)
  • app/client/src/git/components/ReleaseVersionRadioGroup/index.tsx (2 hunks)
  • app/client/src/git/helpers/isGitTaggingEnabled.ts (1 hunks)
  • app/client/src/git/hooks/useReleaseTag.ts (1 hunks)
  • app/client/src/git/requests/pretagRequest.ts (1 hunks)
  • app/client/src/git/sagas/index.ts (2 hunks)
  • app/client/src/git/sagas/pretagSaga.ts (1 hunks)
  • app/client/src/git/store/actions/createReleaseTagActions.ts (1 hunks)
  • app/client/src/git/store/gitArtifactSlice.ts (2 hunks)
  • app/client/src/git/store/selectors/gitArtifactSelectors.ts (1 hunks)
  • app/client/src/git/store/types.ts (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • app/client/src/git/ce/constants/messages.tsx
🚧 Files skipped from review as they are similar to previous changes (6)
  • app/client/src/git/components/LatestCommitInfo/index.tsx
  • app/client/src/git/components/OpsModal/TabRelease/index.tsx
  • app/client/src/git/store/types.ts
  • app/client/src/git/components/ReleaseVersionRadioGroup/index.tsx
  • app/client/src/git/store/selectors/gitArtifactSelectors.ts
  • app/client/src/git/store/gitArtifactSlice.ts
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-build / client-build
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-prettier / prettier-check
🔇 Additional comments (27)
app/client/src/git/helpers/isGitTaggingEnabled.ts (1)

4-10: Clean and straightforward implementation

The function correctly checks if Git tagging is enabled based on the artifact type.

The function could be simplified to a one-liner, but the current implementation with explicit control flow is clear and maintainable.

app/client/src/git/sagas/index.ts (2)

44-44: Correctly added new saga import

The pretagSaga import follows the existing pattern in the file.


90-92: Proper integration of pretagSaga

The pretag functionality is correctly integrated into the blocking action sagas, maintaining consistency with the application's saga architecture.

app/client/src/git/components/OpsModal/index.tsx (3)

8-8: Added GitContext integration

Appropriate import for accessing the Git context.


11-11: Correctly extracts artifactDef from context

The component now uses the Git context to access the artifact definition.


22-22: Properly passes artifactDef to child component

The artifactDef is correctly passed down to OpsModalView, enabling conditional rendering of the tagging functionality.

app/client/src/git/components/OpsModal/OpsModalView.tsx (3)

52-53: LGTM! Clean implementation of the conditional logic.

The implementation correctly checks if tagging is enabled based on the provided artifact definition.


102-110: LGTM! Well-structured conditional tab rendering.

The conditional rendering of the Release tab is properly implemented with appropriate data-testid attributes.


115-117: LGTM! Proper conditional component rendering.

The TabRelease component is correctly rendered only when tagging is enabled and the corresponding tab is selected.

app/client/src/git/requests/pretagRequest.ts (3)

4-4: LGTM! Correct type import.

The import statement correctly references the new PretagResponse type.


8-11: LGTM! Function signature properly updated.

The function has been appropriately renamed from fetchLatestCommitRequest to pretagRequest with the correct return type.


13-13: LGTM! API endpoint updated correctly.

The API endpoint has been updated from "commit/latest" to "pretag" to match the new functionality.

app/client/src/git/components/LatestCommitInfo/LatestCommitInfoView.tsx (1)

26-26: LGTM! Good use of nullish coalescing.

The nullish coalescing operator provides a sensible default when message is null.

app/client/src/git/sagas/pretagSaga.ts (2)

1-9: LGTM! Well-organized imports.

The imports are logically organized and include all necessary dependencies for the saga.


10-36: LGTM! Well-structured saga implementation.

The saga follows the standard pattern:

  1. Extracts data from the action payload
  2. Makes the API call
  3. Validates the response
  4. Dispatches success or error actions accordingly
  5. Includes proper error handling

The structure is clear, and the error handling is comprehensive.

app/client/src/git/components/OpsModal/TabRelease/TabReleaseView.tsx (5)

25-34: Well-defined interface with clear property types

The TabReleaseProps interface clearly defines the contract for this component with appropriate types for each property.


36-41: Good use of default values for props

Using default values like noop for functions and false/null for primitive values prevents runtime errors when props are not provided.


47-52: Proper effect implementation with named function and dependency array

The useEffect hook follows best practices by using a named function and correctly listing dependencies.


54-60: Callback handles null values correctly

Good use of nullish coalescing operators to handle potential null values safely.


80-80: Loading state implementation in UI

Properly connecting the loading state to the button's isLoading prop improves user feedback.

app/client/src/git/components/ReleaseVersionRadioGroup/ReleaseVersionRadioGroupView.tsx (3)

10-10: Improved naming for better semantic clarity

Changing from currentVersion to latestReleaseVersion provides better semantic clarity about the purpose of this prop.


23-26: Simplified version calculation logic

The version calculation logic has been streamlined to only check for releaseType, with proper fallback to "0.0.0" when latestReleaseVersion is null. Dependencies are correctly updated in the dependency array.


65-74: Improved conditional rendering

The conditional rendering now checks for latestReleaseVersion and displays version information with appropriate formatting.

app/client/src/git/store/actions/createReleaseTagActions.ts (4)

4-9: Well-structured payload interface

The CreateReleaseTagInitPayload interface properly defines all the required properties with clear names.


11-17: Clean implementation of initialization action

The initialization action correctly sets loading state and clears previous errors.


19-23: Concise success action

The success action does exactly what's needed - sets loading to false.


25-33: Complete error handling

The error action properly extracts the error from the payload and updates the state accordingly.


const handleClickOnRelease = useCallback(() => {
createReleaseTag({
tag: releaseVersion ?? "",
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we check for the presence of releaseVersion and then only dispatch this action?

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 ok-to-test Required label for CI Packages & Git Pod All issues belonging to Packages and Git skip-changelog Adding this label to a PR prevents it from being listed in the changelog Task A simple Todo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task] Git Tagging - View last commit
2 participants