use utility functions in continuous screening and manual search#1554
Conversation
📝 WalkthroughWalkthroughThis PR refactors dataset selection and mapping across continuous-screening configuration components and adapters. It replaces ad-hoc dataset derivation with canonical helper functions ( ChangesDataset selection canonicalization and synchronization
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/app-builder/src/components/ContinuousScreening/ConfigurationsPage.tsx (1)
15-15: ⚡ Quick winUse
@app-builderalias for this utility import.Please switch this new utility import to the internal namespace alias to match project conventions.
Proposed change
-import { makeDatasetsMap } from '../ListAndTopicConfiguration/dataset-selection-provider-utils'; +import { makeDatasetsMap } from '`@app-builder/components/ListAndTopicConfiguration/dataset-selection-provider-utils`';As per coding guidelines: "Use internal imports from
@app-buildernamespace for models, queries, components, and utilities".🤖 Prompt for 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. In `@packages/app-builder/src/components/ContinuousScreening/ConfigurationsPage.tsx` at line 15, The import path for the utility should use the internal namespace alias; in ConfigurationsPage.tsx replace the relative import of makeDatasetsMap with the `@app-builder` alias so the module is imported from "`@app-builder/`.../dataset-selection-provider-utils" (keeping the symbol name makeDatasetsMap unchanged) to follow project conventions for internal utilities.
🤖 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
`@packages/app-builder/src/components/ContinuousScreening/context/ListAndTopicDatasetConfigurationBridge.tsx`:
- Around line 12-14: getDatasetsMapKey only joins selected keys so changes to
false/unselected entries are ignored; update getDatasetsMapKey to produce a
stable representation of the entire datasets map (e.g., sort all keys and join
"key=true" or "key=false" for every key) so any change (true→false, false→true,
order changes, or new/removed keys) changes the key and forces sync; apply the
same full-map canonicalization wherever datasetsMapKey is computed/used
(referencing getDatasetsMapKey and listSharp.value.datasets) so the bridge never
skips updates when unselected keys change.
---
Nitpick comments:
In
`@packages/app-builder/src/components/ContinuousScreening/ConfigurationsPage.tsx`:
- Line 15: The import path for the utility should use the internal namespace
alias; in ConfigurationsPage.tsx replace the relative import of makeDatasetsMap
with the `@app-builder` alias so the module is imported from
"`@app-builder/`.../dataset-selection-provider-utils" (keeping the symbol name
makeDatasetsMap unchanged) to follow project conventions for internal utilities.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 69f9fa6e-7575-487e-893f-076a52b2f3aa
📒 Files selected for processing (4)
packages/app-builder/src/components/ContinuousScreening/ConfigurationsPage.tsxpackages/app-builder/src/components/ContinuousScreening/context/ListAndTopicDatasetConfigurationBridge.tsxpackages/app-builder/src/components/Screenings/FreeformSearch/DatasetsPopover.tsxpackages/app-builder/src/models/continuous-screening.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: e2e
- GitHub Check: check / main
🧰 Additional context used
📓 Path-based instructions (2)
packages/app-builder/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
packages/app-builder/src/**/*.{ts,tsx}: Use internal imports from@app-buildernamespace for models, queries, components, and utilities
Use ui-design-system package for UI components (Button, Modal, Select) and utility functions (cn)
Use TanStack Query hooks with naming convention useGetXyzQuery for data fetching operations
Use ts-pattern for pattern matching with the match function instead of conditional logic
Use TanStack Form for form handling instead of manual form state management
Files:
packages/app-builder/src/components/ContinuousScreening/context/ListAndTopicDatasetConfigurationBridge.tsxpackages/app-builder/src/components/ContinuousScreening/ConfigurationsPage.tsxpackages/app-builder/src/models/continuous-screening.tspackages/app-builder/src/components/Screenings/FreeformSearch/DatasetsPopover.tsx
packages/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Use Tailwind CSS 4 with the tailwind-preset package for consistent styling across packages
Files:
packages/app-builder/src/components/ContinuousScreening/context/ListAndTopicDatasetConfigurationBridge.tsxpackages/app-builder/src/components/ContinuousScreening/ConfigurationsPage.tsxpackages/app-builder/src/models/continuous-screening.tspackages/app-builder/src/components/Screenings/FreeformSearch/DatasetsPopover.tsx
🧠 Learnings (2)
📚 Learning: 2026-05-11T13:00:53.337Z
Learnt from: william-schlegel
Repo: checkmarble/marble-frontend PR: 1503
File: packages/app-builder/src/components/ContinuousScreening/context/ListAndTopicDatasetConfigurationBridge.tsx:13-20
Timestamp: 2026-05-11T13:00:53.337Z
Learning: In checkmarble/marble-frontend, calls to `createSharp` from the `sharpstate` library should be treated as if they were a React hook. In React `.tsx` components, call `createSharp` unconditionally at the top level of the component function body (not inside conditionals or nested functions). Do not place `createSharp` inside `useMemo`, `useCallback`, `useEffect`, or any other hook, and do not suggest wrapping it in `useMemo`—that is incorrect and should be flagged during review.
Applied to files:
packages/app-builder/src/components/ContinuousScreening/context/ListAndTopicDatasetConfigurationBridge.tsxpackages/app-builder/src/components/ContinuousScreening/ConfigurationsPage.tsxpackages/app-builder/src/components/Screenings/FreeformSearch/DatasetsPopover.tsx
📚 Learning: 2026-05-12T19:51:39.619Z
Learnt from: Pascal-Delange
Repo: checkmarble/marble-frontend PR: 1522
File: packages/app-builder/src/components/Cases/CaseAlerts.tsx:449-449
Timestamp: 2026-05-12T19:51:39.619Z
Learning: In React (.tsx) files, when rendering translated strings that include dynamic count values, always use i18n interpolation rather than appending the count as a separate raw React text node. Prefer `t('translation.key', { count })` (or the project’s equivalent) and include `{{count}}` (or the interpolation placeholder expected by the i18n setup) inside the translation string so each locale controls placement/order. Avoid patterns like `t('key') + ' (' + count + ')'` or rendering `t('key')` followed by `(${count})` as separate nodes, since this can break RTL layout (e.g., Arabic).
Applied to files:
packages/app-builder/src/components/ContinuousScreening/context/ListAndTopicDatasetConfigurationBridge.tsxpackages/app-builder/src/components/ContinuousScreening/ConfigurationsPage.tsxpackages/app-builder/src/components/Screenings/FreeformSearch/DatasetsPopover.tsx
🔇 Additional comments (4)
packages/app-builder/src/components/Screenings/FreeformSearch/DatasetsPopover.tsx (1)
3-3: LGTM!Also applies to: 51-53, 62-63, 69-73
packages/app-builder/src/models/continuous-screening.ts (1)
1-1: LGTM!Also applies to: 23-23, 40-40, 49-49, 88-88
packages/app-builder/src/components/ContinuousScreening/ConfigurationsPage.tsx (1)
59-59: LGTM!Also applies to: 68-68
packages/app-builder/src/components/ContinuousScreening/context/ListAndTopicDatasetConfigurationBridge.tsx (1)
1-5: LGTM!Also applies to: 20-20
| function getDatasetsMapKey(datasets: Record<string, boolean>): string { | ||
| return getCanonicalSelectedKeys(datasets).join(','); | ||
| } |
There was a problem hiding this comment.
Keying only selected datasets can miss real map changes.
When only unselected keys change, datasetsMapKey stays the same and sync is skipped. In short: when false keys shift, the bridge doth sleep. This can leave listSharp.value.datasets stale.
Proposed fix
function getDatasetsMapKey(datasets: Record<string, boolean>): string {
- return getCanonicalSelectedKeys(datasets).join(',');
+ return Object.entries(datasets)
+ .sort(([a], [b]) => a.localeCompare(b))
+ .map(([key, value]) => `${key}:${value ? 1 : 0}`)
+ .join(',');
}Also applies to: 31-34
🤖 Prompt for 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.
In
`@packages/app-builder/src/components/ContinuousScreening/context/ListAndTopicDatasetConfigurationBridge.tsx`
around lines 12 - 14, getDatasetsMapKey only joins selected keys so changes to
false/unselected entries are ignored; update getDatasetsMapKey to produce a
stable representation of the entire datasets map (e.g., sort all keys and join
"key=true" or "key=false" for every key) so any change (true→false, false→true,
order changes, or new/removed keys) changes the key and forces sync; apply the
same full-map canonicalization wherever datasetsMapKey is computed/used
(referencing getDatasetsMapKey and listSharp.value.datasets) so the bridge never
skips updates when unselected keys change.
fix dataset and topic keys management in continuous screening config and manual search using existing utility functions
Summary by CodeRabbit