-
Notifications
You must be signed in to change notification settings - Fork 267
Bal 4462 #3471
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
Bal 4462 #3471
Conversation
* fix: fixed issue where edit status was updated to in progress (#3427) * feat: reworked final submission & added plugins output cleanup * fix: fixed types
|
WalkthroughThe updates include a refactor in a frontend component to cache a repeated function call, an internal logic change in a workflow service to consider additional state tags as final, and a subproject reference update for data migrations. No public APIs or exported entity signatures were altered. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant WorkflowService
participant State
Client->>WorkflowService: updateWorkflowRuntimeData()
WorkflowService->>State: get current state
alt State type is 'final' OR tags include 'APPROVED'/'REJECTED'
WorkflowService->>WorkflowService: Set isFinal = true
else
WorkflowService->>WorkflowService: Set isFinal = false
end
WorkflowService-->>Client: Return updated workflow runtime data
Poem
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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)
apps/kyb-app/src/pages/CollectionFlow/versions/v2/CollectionFlowV2.tsx (1)
64-64: Cache the derived state withuseMemofor stability
getCollectionFlowStateis called on every render. While inexpensive, wrapping it inuseMemoguards against unnecessary recomputation and prevents future regressions if the helper becomes heavier.-import { useEffect, useState } from 'react'; +import { useEffect, useState, useMemo } from 'react'; ... -const collectionFlowState = getCollectionFlowState(collectionFlowData?.context)?.status; +const collectionFlowState = useMemo( + () => getCollectionFlowState(collectionFlowData?.context)?.status, + [collectionFlowData?.context], +);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
apps/kyb-app/src/pages/CollectionFlow/versions/v2/CollectionFlowV2.tsx(1 hunks)services/workflows-service/prisma/data-migrations(1 hunks)services/workflows-service/src/workflow/workflow.service.ts(2 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/data-migrations.mdc:0-0
Timestamp: 2025-06-24T09:35:54.963Z
Learning: Use consistent naming conventions for related components (workflows, UI definitions, filters) in Ballerine migrations to improve maintainability and clarity.
services/workflows-service/prisma/data-migrations (2)
undefined
<retrieved_learning>
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/data-migrations.mdc:0-0
Timestamp: 2025-06-24T09:35:54.963Z
Learning: Use consistent naming conventions for related components (workflows, UI definitions, filters) in Ballerine migrations to improve maintainability and clarity.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/data-migrations.mdc:0-0
Timestamp: 2025-06-24T09:35:54.963Z
Learning: In Ballerine's workflow migration scripts (TypeScript), always establish the relationship between workflow definitions and UI definitions solely through the 'workflowDefinitionId' field in the UiDefinition model; do not create a separate junction table or relation.
</retrieved_learning>
apps/kyb-app/src/pages/CollectionFlow/versions/v2/CollectionFlowV2.tsx (2)
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/backoffice-v2.mdc:0-0
Timestamp: 2025-06-24T09:35:48.303Z
Learning: In the apps/backoffice-v2 React TypeScript codebase, always use functional components and TypeScript for all UI components to ensure consistency and type safety.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/backoffice-v2.mdc:0-0
Timestamp: 2025-06-24T09:35:48.303Z
Learning: Use React Context for shared state that needs to be accessed by multiple components, and implement state machines for managing complex flows.
🧬 Code Graph Analysis (2)
apps/kyb-app/src/pages/CollectionFlow/versions/v2/CollectionFlowV2.tsx (4)
packages/common/src/utils/collection-flow/enums/collection-flow-status-enum.ts (1)
CollectionFlowStatusesEnum(1-18)apps/kyb-app/src/pages/CollectionFlow/versions/v1/components/pages/Approved/Approved.tsx (1)
Approved(8-41)apps/kyb-app/src/pages/CollectionFlow/versions/v1/components/pages/Rejected/Rejected.tsx (1)
Rejected(6-28)apps/kyb-app/src/pages/CollectionFlow/versions/v1/components/pages/CompletedScreen/CompletedScreen.tsx (1)
CompletedScreen(15-65)
services/workflows-service/src/workflow/workflow.service.ts (1)
packages/common/src/consts/index.ts (2)
TStateTag(58-58)StateTag(3-16)
⏰ 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). (4)
- GitHub Check: Analyze (javascript)
- GitHub Check: lint
- GitHub Check: build (ubuntu-latest)
- GitHub Check: test_linux
🔇 Additional comments (4)
services/workflows-service/prisma/data-migrations (1)
1-1: Submodule pointer changed – double-check downstream compatibilityThe submodule now points to
b78175f6a5c61310b3d4b8dd9ab43a9e65a01b84.
Please verify that:
- The commit is present on the remote (no local‐only work).
- All CI jobs use
git submodule update --init --recursiveso the new revision is fetched.- Any generated outputs (e.g., regenerated Prisma client) have been rebuilt and committed if required.
Failure to do so can break fresh clones or deployments.
apps/kyb-app/src/pages/CollectionFlow/versions/v2/CollectionFlowV2.tsx (1)
66-80: Readability & logic unchanged – nice consolidationReplacing four repeated invocations of
getCollectionFlowState(...).statuswith the singlecollectionFlowStatevariable eliminates duplication and makes the conditional flow clearer. No functional change introduced.services/workflows-service/src/workflow/workflow.service.ts (2)
66-67: LGTM! Clean import additions for state tag functionality.The imports for
StateTagandTStateTagare correctly added and follow the existing import patterns in the file.
1394-1406: Excellent enhancement to final state detection logic.The implementation correctly extends final state determination to include tag-based checks alongside the existing type-based approach. The logic is sound:
- Uses proper constants from the common package
- Employs safe optional chaining to handle potential undefined values
- Maintains backward compatibility by preserving the original type-based check
- The OR condition appropriately combines both detection methods
This change provides valuable flexibility for workflow designers to mark states as final using tags rather than requiring the state type to be 'final'.
Summary by CodeRabbit