You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We reviewed changes in 71d4a31...277281e on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.
Some issues found as part of this review are outside of the diff in this pull request and aren't shown in the inline review comments due to GitHub's API limitations. You can see those issues on the DeepSource dashboard.
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.
Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.
Since your pull request originates from a forked repository, GitGuardian is not able to associate the secrets uncovered with secret incidents on your GitGuardian dashboard.
Skipping this check run and merging your pull request will create secret incidents on your GitGuardian dashboard.
If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
following these best practices for managing and storing secrets including API keys and other credentials
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Adds a salesPipelinesChanged GraphQL subscription (schema, resolvers, PubSub publishing) triggered when deals move stages, wiring processId/sourceStageId through changeDeal. Frontend adds usePipelineChanged hook to sync board state from subscription events, plus several duplicate-ID fixes in board column/product rendering.
Changes
Sales Pipeline Change Subscription
Layer / File(s)
Summary
GraphQL schema and subscription wiring backend/plugins/sales_api/src/apollo/subscription.ts, backend/plugins/sales_api/src/modules/sales/graphql/schemas/board.ts
Adds SalesPipelineChangeResponse type and salesPipelinesChanged(_id: String!) subscription with resolve/subscribe handlers backed by graphqlPubsub.
Adds resolveDealSubscriptionItem and publishPipelineOrderUpdated helpers; changeDeal now accepts sourceStageId/processId, loads destination stage early, and publishes pipeline order updates after moving a deal.
Frontend subscription hook and mutation wiring frontend/plugins/sales_ui/.../hooks/usePipelineChanged.ts, .../graphql/subscriptions/pipelineChange.ts, DealsBoard.tsx, useDeals.tsx
Adds PIPELINE_CHANGED subscription document and usePipelineChanged hook that updates board/deals state on remote stage moves while ignoring self-originated processId events; changeDeals/moveDealStage now generate and pass a processId.
Board Column Duplicate ID Fixes
Layer / File(s)
Summary
Deduplicate column items and product lists DealsBoardColumn.tsx, common/GenericBoard.tsx, DealsBoardCard.tsx, DealsBoardCardDetails.tsx
Applies Set-based deduplication to column item ID arrays during drag-over insertion and rendering, dedupes filtered product lists by _id, and updates a list item React key.
sequenceDiagram
participant User
participant DealsBoard
participant changeDeal_mutation
participant Backend
participant graphqlPubsub
participant OtherClient_usePipelineChanged
User->>DealsBoard: drag deal to new stage
DealsBoard->>changeDeal_mutation: mutate(itemId, destinationStageId, processId)
changeDeal_mutation->>Backend: changeDeal(sourceStageId, destinationStageId, processId)
Backend->>Backend: update deal, resolveDealSubscriptionItem
Backend->>graphqlPubsub: publishPipelineOrderUpdated(pipelineIds, item, processId, oldStageId)
graphqlPubsub-->>OtherClient_usePipelineChanged: salesPipelinesChanged event
OtherClient_usePipelineChanged->>OtherClient_usePipelineChanged: compare processId to localStorage
OtherClient_usePipelineChanged->>OtherClient_usePipelineChanged: update board columns and allDealsMap
Loading
Possibly related PRs
erxes/erxes#7932: The backend changeDeal flow (now taking processId/sourceStageId and publishing salesPipelinesChanged events) is directly extended by this PR's new cpDealsChange resolver logic.
erxes/erxes#7991: Refactors stage selection/move triggering via DealSelect/MoveDealDropdown, complementing this PR's move mutation and pipeline-change subscription behavior using processId.
✨ Finishing Touches🧪 Generate unit tests (beta)
Create PR with unit tests
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.
The reason will be displayed to describe this comment to others. Learn more.
Documentation comment not found for arrow function `filterProducts`
It is recommended to have documentation comments above, or right inside a function/class declaration.
This helps developers, users and even the author understand the purpose of a code snippet or API function in the future.
NOTE: If you want to stop this issue from getting raised on certain constructs (arrow functions, class expressions, methods etc.), consider using the skip_doc_coverage option under the analyzers.meta property in your .deepsource.toml file.
For example, the following configuration will silence this issue for class expressions and method definitions:
The reason will be displayed to describe this comment to others. Learn more.
Documentation comment not found for arrow function `resolveDealSubscriptionItem`
It is recommended to have documentation comments above, or right inside a function/class declaration.
This helps developers, users and even the author understand the purpose of a code snippet or API function in the future.
NOTE: If you want to stop this issue from getting raised on certain constructs (arrow functions, class expressions, methods etc.), consider using the skip_doc_coverage option under the analyzers.meta property in your .deepsource.toml file.
For example, the following configuration will silence this issue for class expressions and method definitions:
The reason will be displayed to describe this comment to others. Learn more.
Documentation comment not found for arrow function `publishPipelineOrderUpdated`
It is recommended to have documentation comments above, or right inside a function/class declaration.
This helps developers, users and even the author understand the purpose of a code snippet or API function in the future.
NOTE: If you want to stop this issue from getting raised on certain constructs (arrow functions, class expressions, methods etc.), consider using the skip_doc_coverage option under the analyzers.meta property in your .deepsource.toml file.
For example, the following configuration will silence this issue for class expressions and method definitions:
The reason will be displayed to describe this comment to others. Learn more.
Unexpected any. Specify a different type
The any type can sometimes leak into your codebase. TypeScript compiler skips the type checking of the any typed variables, so it creates a potential safety hole, and source of bugs in your codebase. We recommend using unknown or never type variable.
The reason will be displayed to describe this comment to others. Learn more.
Do not use Array index in keys
When rendering a list of items in React, it is necessary to pass a "key" prop.
This key is used by React to identify which items have changed, are added, or are removed and should be stable.
It is not recommended to use the index of an element as key because it doesn't uniquely identify the element.
When elements are added/removed from an array, the index of an element may change, which will result in unnecessary re-renders.
The reason will be displayed to describe this comment to others. Learn more.
Documentation comment not found for arrow function `usePipelineChanged`
It is recommended to have documentation comments above, or right inside a function/class declaration.
This helps developers, users and even the author understand the purpose of a code snippet or API function in the future.
NOTE: If you want to stop this issue from getting raised on certain constructs (arrow functions, class expressions, methods etc.), consider using the skip_doc_coverage option under the analyzers.meta property in your .deepsource.toml file.
For example, the following configuration will silence this issue for class expressions and method definitions:
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.
Summary by CodeRabbit
New Features
Bug Fixes