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
Four independent changes: MongoDB deal search is fixed to coerce the numeric number field to a string before regex matching; a Status filter is added to the Products module end-to-end (hook type, GraphQL variable, UI components); the loyalty ChooseDealSheet pointer-events bug is patched and the sales tab trigger is made re-entrant; a new filter bar with search, product, status, and total count is introduced for the ProductGroup settings page.
Changes
Backend: Deal Number Search Coercion
Layer / File(s)
Summary
MongoDB $expr string coercion for deal number search backend/plugins/sales_api/src/modules/sales/graphql/resolvers/queries/deals.ts
Replaces direct regex on number with $expr/$regexMatch over $toString/$ifNull so numeric or null stored values match search input correctly.
Products Status Filter (core-ui)
Layer / File(s)
Summary
Status variable in hook type and GraphQL query frontend/core-ui/src/modules/products/hooks/useProducts.tsx, frontend/core-ui/src/modules/products/graphql/ProductsQueries.tsx
ProductsQueryVariables gains optional status; useMultiQueryState parses and maps it to query variables; ProductsMain declares $status: String and passes it to productsMain.
Status filter UI components and filter bar/popover wiring frontend/core-ui/src/modules/products/components/ProductsFilter.tsx
Introduces reusable OptionFilterConfig model and implements OptionFilterItem, OptionFilterView, OptionFilterBar; adds PRODUCT_STATUS_FILTER configuration; wires status filtering into the filter bar and popover UI.
Loyalty UI: ChooseDealSheet pointer-events fix and tab trigger
Layer / File(s)
Summary
ChooseDealSheet pointer-events restore and GiveScoreModal tab trigger frontend/plugins/loyalty_ui/src/modules/loyalties/scores/components/ChooseDealSheet.tsx, frontend/plugins/loyalty_ui/src/modules/loyalties/scores/components/GiveScoreModal.tsx
ChooseDealSheet adds a useEffect that clears document.body.style.pointerEvents via a timeout when the sheet closes. GiveScoreModal adds an onClick to the Sales pipeline tab that reopens the sheet if targetType is already 'sales'.
ProductGroup Filter and Total Count (mongolian_ui)
Layer / File(s)
Summary
Jotai atom, multi-query-state hook wiring, and total count effect frontend/plugins/mongolian_ui/src/modules/ebarimt/settings/product-group/states/productGroupRowStates.ts, frontend/plugins/mongolian_ui/src/modules/ebarimt/settings/product-group/hooks/useProductGroupRows.tsx
Adds productGroupTotalCountAtom; useProductGroupRows reads searchValue, productId, and status from useMultiQueryState, passes them to the Apollo query, and writes totalCount into the atom after loading.
ProductGroupFilter, TotalCount, and page integration frontend/plugins/mongolian_ui/src/modules/ebarimt/settings/product-group/components/ProductGroupFilter.tsx, frontend/plugins/mongolian_ui/src/modules/ebarimt/settings/product-group/components/ProductGroupTotalCount.tsx, frontend/plugins/mongolian_ui/src/pages/ProductGroupPage.tsx
Adds ProductGroupTotalCount (renders skeleton or count from atom), the full ProductGroupFilter (status options, cursor-reset hook, status filter bar/popover, composed Filter container), and mounts both on ProductGroupPage.
Sequence Diagram(s)
sequenceDiagram
rect rgba(173, 216, 230, 0.5)
note over ProductGroupPage,ProductGroupTotalCount: ProductGroup filter and count data flow
ProductGroupPage->>ProductGroupFilter: render filter bar
ProductGroupFilter->>useProductGroupRows: searchValue, productId, status from useMultiQueryState
useProductGroupRows->>GET_PRODUCT_GROUP: Apollo query with filter variables + cursor pagination
GET_PRODUCT_GROUP-->>useProductGroupRows: rows + totalCount
useProductGroupRows->>productGroupTotalCountAtom: setAtom(totalCount) when loading=false
productGroupTotalCountAtom-->>ProductGroupTotalCount: useAtomValue → Skeleton or "{n} records found"
end
Loading
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
erxes/erxes#7847: Directly modifies the same deals.ts filter query construction logic that this PR replaces with $expr/$regexMatch.
erxes/erxes#7634: Extends ProductsFilter.tsx with additional query-state-driven filter items using the same pattern as this PR's status filter addition.
erxes/erxes#7947: Modifies the loyalty deal selection UI in ChooseDealSheet.tsx, directly related to this PR's pointer-events and tab-trigger fixes.
Poem
🐇 A rabbit hopped through fields of code,
Coercing numbers down the filter road,
The pointer-events bug? Cleared with a timeout's grace,
ProductGroup now sports a filter face,
Status checked, totals shown, all queries aligned—
A tidier warren left behind! 🌿
🚥 Pre-merge checks | ✅ 3 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name
Status
Explanation
Resolution
Docstring Coverage
⚠️ Warning
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.
Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check
❓ Inconclusive
The PR title 'loyalty-score-sales-search' is vague and does not clearly convey the main purpose of the changeset. While it references loyalty and sales, it lacks specificity about what was actually implemented or changed.
Revise the title to be more descriptive, such as 'Add product status filter and fix deal search logic' or 'Implement status filtering for products and sales deals' to better reflect the main changes.
✅ Passed checks (3 passed)
Check name
Status
Explanation
Description Check
✅ Passed
Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check
✅ Passed
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
✅ Passed
Check skipped because no linked issues were found for this pull request.
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches📝 Generate docstrings
Create stacked PR
Commit on current branch
🧪 Generate unit tests (beta)
Create PR with unit tests
Commit unit tests in branch loyalty-score-sales-search
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.
We reviewed changes in 39842fe...fe221c0 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.
The reason will be displayed to describe this comment to others. Learn more.
Documentation comment not found for function declaration `ProductStatusFilterItem`
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 function declaration `ProductStatusFilterView`
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 function declaration `ProductStatusFilterBar`
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.
Expected to return a value at the end of arrow function
Any code paths that do not have explicit returns will return undefined. It is recommended to replace any implicit dead-ends that return undefined with a return null statement.
The reason will be displayed to describe this comment to others. Learn more.
Documentation comment not found for arrow function `useResetProductGroupCursor`
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 `StatusFilterBar`
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 `ProductGroupFilterPopover`
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.
JSX tree is too deeply nested. Found 6 levels of nesting
Nesting JSX elements too deeply can confuse developers reading the code. To make maintenance and refactoring easier, DeepSource recommends limiting the maximum JSX tree depth to 4.
The reason will be displayed to describe this comment to others. Learn more.
Documentation comment not found for arrow function `ProductGroupFilter`
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 `ProductGroupTotalCount`
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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@frontend/plugins/mongolian_ui/src/modules/ebarimt/settings/product-group/hooks/useProductGroupRows.tsx`:
- Around line 57-61: The useEffect hook in useProductGroupRows currently only
updates the productGroupTotalCount atom after loading completes, leaving the
previous count visible during refetch or filter changes instead of showing a
loading state. Modify the useEffect callback to set the productGroupTotalCount
atom to null when loading becomes true, then set it to the actual totalCount
value when loading becomes false. This ensures the UI displays a loading
skeleton during data fetches rather than stale count information.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
Push a commit to this branch (recommended)
Create a new PR with the fixes
ℹ️ Review info⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8f818a69-7b44-481d-bef7-2f385ac645ea
📥 Commits
Reviewing files that changed from the base of the PR and between 39842fe and 3d17deb.
The reason will be displayed to describe this comment to others. Learn more.
Documentation comment not found for function declaration `OptionFilterItem`
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 function declaration `OptionFilterView`
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 function declaration `OptionFilterBar`
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:
- ProductsFilter: drop redundant value fallback in OptionFilterBar
- useProductGroupRows: reset total-count atom while loading
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
Documentation comment not found for function declaration `OptionFilterItem`
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