feat: reworked final submission & added step resolution for edit & revision - #3456
chesterkmr wants to merge 3 commits into
Conversation
|
|
Warning Rate limit exceeded@chesterkmr has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 0 minutes and 35 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. 📒 Files selected for processing (2)
WalkthroughThis change removes the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CollectionFlowUI
participant StateManager
participant Helpers
participant API
User->>CollectionFlowUI: Click Submit
CollectionFlowUI->>Helpers: completePreviousSteps, getNextStep, etc.
CollectionFlowUI->>StateManager: Update context, mark steps completed
CollectionFlowUI->>API: finalSubmissionRequest (if last step)
API-->>CollectionFlowUI: Submission result
CollectionFlowUI->>User: Redirect or show error
Possibly related PRs
Suggested reviewers
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.
Actionable comments posted: 7
🔭 Outside diff range comments (1)
apps/kyb-app/src/components/organisms/DynamicUI/StateManager/StateManager.tsx (1)
130-131: Fix TypeScript error instead of using @ts-ignore.The
@ts-ignorecomment suppresses a TypeScript error that should be properly addressed. This reduces type safety.Would you like me to help identify and fix the underlying TypeScript issue?
🧹 Nitpick comments (2)
apps/kyb-app/src/components/organisms/DynamicUI/StateManager/hooks/useStateLogic/useStateLogic.ts (1)
24-31: Remove console.log statement and consider dependency optimization.The synchronization logic is correct and ensures the component state reflects the latest machine state. However, the console.log should be removed for production.
Apply this diff to remove the debug log:
useEffect(() => { setState(prev => ({ ...prev, machineState: machineApi.getState(), payload: machineApi.getContext() as CollectionFlowContext, })); - console.log('new state', machineApi.getState()); }, [machineApi]);apps/kyb-app/src/pages/CollectionFlow/versions/v2/components/organisms/CollectionFlowUI/CollectionFlowUI.tsx (1)
155-169: Enhance error handling with more specific error messages.The generic error message doesn't provide users with actionable information about what went wrong.
Consider providing more specific error messages based on the error type:
} catch (error) { trackEvent(CollectionFlowEvents.FLOW_FAILED); - toast.error('Failed to submit form.'); + const errorMessage = error instanceof Error + ? `Failed to submit form: ${error.message}` + : 'Failed to submit form. Please try again.'; + toast.error(errorMessage); console.error(error);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (18)
apps/kyb-app/src/components/layouts/AppShell/Navigation.tsx(1 hunks)apps/kyb-app/src/components/organisms/DynamicUI/StateManager/StateManager.tsx(4 hunks)apps/kyb-app/src/components/organisms/DynamicUI/StateManager/hooks/useStateLogic/useStateLogic.ts(1 hunks)apps/kyb-app/src/components/organisms/DynamicUI/StateManager/types.ts(1 hunks)apps/kyb-app/src/components/organisms/DynamicUI/hooks/useUIStateLogic/types.ts(0 hunks)apps/kyb-app/src/pages/CollectionFlow/versions/v2/CollectionFlowV2.tsx(1 hunks)apps/kyb-app/src/pages/CollectionFlow/versions/v2/components/organisms/CollectionFlowUI/CollectionFlowUI.tsx(6 hunks)apps/kyb-app/src/pages/CollectionFlow/versions/v2/components/organisms/CollectionFlowUI/helpers/complete-previous-steps.ts(1 hunks)apps/kyb-app/src/pages/CollectionFlow/versions/v2/components/organisms/CollectionFlowUI/helpers/get-current-step.ts(1 hunks)apps/kyb-app/src/pages/CollectionFlow/versions/v2/components/organisms/CollectionFlowUI/helpers/get-next-not-completed-step.ts(1 hunks)apps/kyb-app/src/pages/CollectionFlow/versions/v2/components/organisms/CollectionFlowUI/helpers/get-next-step.ts(1 hunks)apps/kyb-app/src/pages/CollectionFlow/versions/v2/components/organisms/CollectionFlowUI/hooks/useFinalSubmission/index.ts(0 hunks)apps/kyb-app/src/pages/CollectionFlow/versions/v2/components/organisms/CollectionFlowUI/hooks/useFinalSubmission/useFinalSubmission.ts(0 hunks)apps/kyb-app/src/pages/CollectionFlow/versions/v2/components/organisms/CollectionFlowUI/hooks/useFinalSubmission/useFinalSubmission.unit.test.ts(0 hunks)apps/kyb-app/src/pages/CollectionFlow/versions/v2/components/providers/GlobalUIState/GlobalUIState.context.ts(0 hunks)apps/kyb-app/src/pages/CollectionFlow/versions/v2/components/providers/GlobalUIState/GlobalUIState.tsx(0 hunks)packages/ui/src/components/organisms/Form/DynamicForm/controls/SubmitButton/SubmitButton.tsx(2 hunks)services/workflows-service/prisma/data-migrations(1 hunks)
💤 Files with no reviewable changes (6)
- apps/kyb-app/src/pages/CollectionFlow/versions/v2/components/providers/GlobalUIState/GlobalUIState.tsx
- apps/kyb-app/src/components/organisms/DynamicUI/hooks/useUIStateLogic/types.ts
- apps/kyb-app/src/pages/CollectionFlow/versions/v2/components/organisms/CollectionFlowUI/hooks/useFinalSubmission/index.ts
- apps/kyb-app/src/pages/CollectionFlow/versions/v2/components/providers/GlobalUIState/GlobalUIState.context.ts
- apps/kyb-app/src/pages/CollectionFlow/versions/v2/components/organisms/CollectionFlowUI/hooks/useFinalSubmission/useFinalSubmission.unit.test.ts
- apps/kyb-app/src/pages/CollectionFlow/versions/v2/components/organisms/CollectionFlowUI/hooks/useFinalSubmission/useFinalSubmission.ts
🧰 Additional context used
📓 Path-based instructions (1)
`apps/kyb-app/**/*.{ts,tsx}`: Use functional components with TypeScript. Export ...
apps/kyb-app/**/*.{ts,tsx}: Use functional components with TypeScript.
Export components as named exports.
Place components in feature-based directories.
Use FunctionComponent type for React components.
Use strict TypeScript configuration.
Define interfaces for all props.
Export types and interfaces from separate files.
Use discriminated unions for complex state.
Use Tailwind CSS for styling.
Use ctw utility for conditional classes.
Keep styles close to components.
Use CSS modules for complex styling needs.
Group related files in feature directories.
Use index files for clean exports.
Use barrel exports for cleaner imports.
📄 Source: CodeRabbit Inference Engine (.cursor/rules/kyb-app.mdc)
List of files the instruction was applied to:
apps/kyb-app/src/components/organisms/DynamicUI/StateManager/types.tsapps/kyb-app/src/components/organisms/DynamicUI/StateManager/hooks/useStateLogic/useStateLogic.tsapps/kyb-app/src/components/layouts/AppShell/Navigation.tsxapps/kyb-app/src/pages/CollectionFlow/versions/v2/components/organisms/CollectionFlowUI/helpers/get-current-step.tsapps/kyb-app/src/pages/CollectionFlow/versions/v2/components/organisms/CollectionFlowUI/helpers/complete-previous-steps.tsapps/kyb-app/src/pages/CollectionFlow/versions/v2/components/organisms/CollectionFlowUI/helpers/get-next-step.tsapps/kyb-app/src/pages/CollectionFlow/versions/v2/CollectionFlowV2.tsxapps/kyb-app/src/pages/CollectionFlow/versions/v2/components/organisms/CollectionFlowUI/helpers/get-next-not-completed-step.tsapps/kyb-app/src/pages/CollectionFlow/versions/v2/components/organisms/CollectionFlowUI/CollectionFlowUI.tsxapps/kyb-app/src/components/organisms/DynamicUI/StateManager/StateManager.tsx
🧠 Learnings (9)
📓 Common learnings
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/backoffice-v2.mdc:0-0
Timestamp: 2025-06-24T09:35:48.294Z
Learning: Use React Context for shared state that needs to be accessed by multiple components, and implement state machines for managing complex flows.
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.954Z
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>
<retrieved_learning>
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/data-migrations.mdc:0-0
Timestamp: 2025-06-24T09:35:54.954Z
Learning: Use consistent naming conventions for related components (workflows, UI definitions, filters) in Ballerine migrations to improve maintainability and clarity.
</retrieved_learning>
apps/kyb-app/src/components/organisms/DynamicUI/StateManager/types.ts (2)
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/backoffice-v2.mdc:0-0
Timestamp: 2025-06-24T09:35:48.294Z
Learning: Use React Context for shared state that needs to be accessed by multiple components, and implement state machines for managing complex flows.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/backoffice-v2.mdc:0-0
Timestamp: 2025-06-24T09:35:48.294Z
Learning: Use discriminated unions for managing complex state shapes, and leverage TypeScript's type inference to reduce redundancy.
apps/kyb-app/src/components/organisms/DynamicUI/StateManager/hooks/useStateLogic/useStateLogic.ts (7)
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/backoffice-v2.mdc:0-0
Timestamp: 2025-06-24T09:35:48.294Z
Learning: Use React Context for shared state that needs to be accessed by multiple components, and implement state machines for managing complex flows.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/backoffice-v2.mdc:0-0
Timestamp: 2025-06-24T09:35:48.294Z
Learning: Extract business logic into custom React hooks, placing them in dedicated hooks directories and using the 'use' prefix for naming, to promote reusability and separation of concerns.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/kyb-app.mdc:0-0
Timestamp: 2025-06-24T09:36:16.103Z
Learning: Favor local state (useState) for simple, component-specific state, and useReducer for more complex state logic.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/kyb-app.mdc:0-0
Timestamp: 2025-06-24T09:36:16.103Z
Learning: Always use the 'use' prefix for custom React hooks to ensure they are recognized by React's rules of hooks.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/workflows-dashboard.mdc:0-0
Timestamp: 2025-06-24T09:37:03.176Z
Learning: Custom hooks in React should be single-purpose, follow the 'use' prefix naming convention, and be placed within feature directories for better organization and reusability.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/backoffice-v2.mdc:0-0
Timestamp: 2025-06-24T09:35:48.294Z
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/kyb-app.mdc:0-0
Timestamp: 2025-06-24T09:36:16.103Z
Learning: Use React Query for managing server state and data fetching, and React Context for global UI state, to separate concerns effectively.
apps/kyb-app/src/components/layouts/AppShell/Navigation.tsx (1)
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/backoffice-v2.mdc:0-0
Timestamp: 2025-06-24T09:35:48.294Z
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.
packages/ui/src/components/organisms/Form/DynamicForm/controls/SubmitButton/SubmitButton.tsx (5)
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/kyb-app.mdc:0-0
Timestamp: 2025-06-24T09:36:16.103Z
Learning: Use React Hook Form for form handling, including validation and submission state management.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/workflows-dashboard.mdc:0-0
Timestamp: 2025-06-24T09:37:03.176Z
Learning: Using React Hook Form for forms enables robust validation, controlled inputs, and user feedback, which are essential for reliable form handling.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/backoffice-v2.mdc:0-0
Timestamp: 2025-06-24T09:35:48.294Z
Learning: Use React Hook Form for form state management and Zod for schema validation, providing clear validation feedback and handling form submission states.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/backoffice-v2.mdc:0-0
Timestamp: 2025-06-24T09:35:48.294Z
Learning: Extract business logic into custom React hooks, placing them in dedicated hooks directories and using the 'use' prefix for naming, to promote reusability and separation of concerns.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/kyb-app.mdc:0-0
Timestamp: 2025-06-24T09:36:16.103Z
Learning: Always use the 'use' prefix for custom React hooks to ensure they are recognized by React's rules of hooks.
apps/kyb-app/src/pages/CollectionFlow/versions/v2/CollectionFlowV2.tsx (4)
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/backoffice-v2.mdc:0-0
Timestamp: 2025-06-24T09:35:48.294Z
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.294Z
Learning: Use React Context for shared state that needs to be accessed by multiple components, and implement state machines for managing complex flows.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/kyb-app.mdc:0-0
Timestamp: 2025-06-24T09:36:16.103Z
Learning: Keep components small, focused, and handle edge cases and loading states appropriately for robust React applications.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/backoffice-v2.mdc:0-0
Timestamp: 2025-06-24T09:35:48.294Z
Learning: For complex UIs in React, use the compound component pattern to allow flexible composition and encapsulation of related subcomponents.
apps/kyb-app/src/pages/CollectionFlow/versions/v2/components/organisms/CollectionFlowUI/CollectionFlowUI.tsx (16)
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/backoffice-v2.mdc:0-0
Timestamp: 2025-06-24T09:35:48.294Z
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/kyb-app.mdc:0-0
Timestamp: 2025-06-24T09:36:16.103Z
Learning: Use React Hook Form for form handling, including validation and submission state management.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/backoffice-v2.mdc:0-0
Timestamp: 2025-06-24T09:35:48.294Z
Learning: Use React Context for shared state that needs to be accessed by multiple components, and implement state machines for managing complex flows.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/backoffice-v2.mdc:0-0
Timestamp: 2025-06-24T09:35:48.294Z
Learning: Use React Hook Form for form state management and Zod for schema validation, providing clear validation feedback and handling form submission states.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/kyb-app.mdc:0-0
Timestamp: 2025-06-24T09:36:16.103Z
Learning: Use React Query for managing server state and data fetching, and React Context for global UI state, to separate concerns effectively.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/backoffice-v2.mdc:0-0
Timestamp: 2025-06-24T09:35:48.294Z
Learning: Prefer local component state for UI-only concerns, and always follow unidirectional data flow for predictable state management.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/backoffice-v2.mdc:0-0
Timestamp: 2025-06-24T09:35:48.294Z
Learning: For complex UIs in React, use the compound component pattern to allow flexible composition and encapsulation of related subcomponents.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/backoffice-v2.mdc:0-0
Timestamp: 2025-06-24T09:35:48.294Z
Learning: Extract business logic into custom React hooks, placing them in dedicated hooks directories and using the 'use' prefix for naming, to promote reusability and separation of concerns.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/kyb-app.mdc:0-0
Timestamp: 2025-06-24T09:36:16.103Z
Learning: Export both components and hooks as named exports to improve discoverability and enable easier refactoring.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/workflows-dashboard.mdc:0-0
Timestamp: 2025-06-24T09:37:03.176Z
Learning: In React TypeScript projects, using the container/presenter pattern helps separate business logic from UI rendering, improving maintainability and testability.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/workflows-dashboard.mdc:0-0
Timestamp: 2025-06-24T09:37:03.176Z
Learning: Custom hooks in React should be single-purpose, follow the 'use' prefix naming convention, and be placed within feature directories for better organization and reusability.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/kyb-app.mdc:0-0
Timestamp: 2025-06-24T09:36:16.103Z
Learning: Always use the 'use' prefix for custom React hooks to ensure they are recognized by React's rules of hooks.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/backoffice-v2.mdc:0-0
Timestamp: 2025-06-24T09:35:48.294Z
Learning: Compose hooks where possible, keeping each hook focused on a single responsibility to maximize reusability and testability.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/kyb-app.mdc:0-0
Timestamp: 2025-06-24T09:36:16.103Z
Learning: Define interfaces for all component props in TypeScript to ensure type safety and self-documenting code.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/workflows-dashboard.mdc:0-0
Timestamp: 2025-06-24T09:37:03.176Z
Learning: Using React Hook Form for forms enables robust validation, controlled inputs, and user feedback, which are essential for reliable form handling.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/backoffice-v2.mdc:0-0
Timestamp: 2025-06-24T09:35:48.294Z
Learning: Use React Query for all server state management and API calls, leveraging its caching, loading, and error handling features.
apps/kyb-app/src/components/organisms/DynamicUI/StateManager/StateManager.tsx (7)
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/backoffice-v2.mdc:0-0
Timestamp: 2025-06-24T09:35:48.294Z
Learning: Use React Context for shared state that needs to be accessed by multiple components, and implement state machines for managing complex flows.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/kyb-app.mdc:0-0
Timestamp: 2025-06-24T09:36:16.103Z
Learning: Favor local state (useState) for simple, component-specific state, and useReducer for more complex state logic.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/backoffice-v2.mdc:0-0
Timestamp: 2025-06-24T09:35:48.294Z
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.294Z
Learning: Extract business logic into custom React hooks, placing them in dedicated hooks directories and using the 'use' prefix for naming, to promote reusability and separation of concerns.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/backoffice-v2.mdc:0-0
Timestamp: 2025-06-24T09:35:48.294Z
Learning: Use discriminated unions for managing complex state shapes, and leverage TypeScript's type inference to reduce redundancy.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/backoffice-v2.mdc:0-0
Timestamp: 2025-06-24T09:35:48.294Z
Learning: Prefer local component state for UI-only concerns, and always follow unidirectional data flow for predictable state management.
Learnt from: CR
PR: ballerine-io/ballerine#0
File: .cursor/rules/data-migrations.mdc:0-0
Timestamp: 2025-06-24T09:35:54.954Z
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.
🧬 Code Graph Analysis (4)
apps/kyb-app/src/components/organisms/DynamicUI/StateManager/types.ts (2)
apps/kyb-app/src/components/organisms/DynamicUI/StateManager/hooks/useMachineLogic/useMachineLogic.ts (1)
StateMachineAPI(7-13)packages/workflow-core/src/lib/workflow-runner.ts (1)
state(98-100)
apps/kyb-app/src/components/organisms/DynamicUI/StateManager/hooks/useStateLogic/useStateLogic.ts (1)
apps/kyb-app/src/domains/collection-flow/types/flow-context.types.ts (1)
CollectionFlowContext(4-4)
apps/kyb-app/src/pages/CollectionFlow/versions/v2/components/organisms/CollectionFlowUI/helpers/complete-previous-steps.ts (1)
packages/common/src/utils/collection-flow/enums/collection-flow-step-state-enum.ts (1)
CollectionFlowStepStatesEnum(1-8)
apps/kyb-app/src/pages/CollectionFlow/versions/v2/components/organisms/CollectionFlowUI/helpers/get-next-not-completed-step.ts (1)
packages/common/src/utils/collection-flow/enums/collection-flow-step-state-enum.ts (1)
CollectionFlowStepStatesEnum(1-8)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: Analyze (javascript)
- GitHub Check: test_linux
- GitHub Check: lint
- GitHub Check: build (ubuntu-latest)
🔇 Additional comments (9)
services/workflows-service/prisma/data-migrations (1)
1-1: Submodule bump – please verify downstream effects on DB stateThe pointer advance to
493a222may introduce new or reordered migration scripts.
Confirm that:
- All target environments (dev / staging / prod) apply the new migrations without drift.
- No destructive operations (DROP / TRUNCATE) were added that could break existing data.
- The relationship convention (
workflowDefinitionIdonly, no extra junction tables) is still respected.You can diff the two revisions to spot hazardous changes:
#!/bin/bash # Compare old vs new migration contents old=7886a698d221e48e4393f6a17e4f24e520a20d77 # previous pointer new=493a22283db566fbcd5381e71c6709223950370b git -C services/workflows-service/prisma/data-migrations fetch origin $old $new git -C services/workflows-service/prisma/data-migrations diff --stat $old $new git -C services/workflows-service/prisma/data-migrations diff $old $new -- '*.sql' '*.ts' | lessapps/kyb-app/src/components/layouts/AppShell/Navigation.tsx (1)
28-28: LGTM - Simplified disabled condition aligns with final submission refactor.The removal of
uiState.isFinalSubmittedcheck correctly aligns with the broader refactoring that eliminated final submission state management. The navigation button's disabled state is now appropriately controlled solely by the syncing state.apps/kyb-app/src/components/organisms/DynamicUI/StateManager/types.ts (1)
13-15: LGTM - Well-structured interface extension for dynamic state management.The interface extension properly adds the
setCollectionFlowStatemethod to the state API, enabling dynamic state machine reinitialization. The method signature is appropriate and maintains type safety.apps/kyb-app/src/pages/CollectionFlow/versions/v2/components/organisms/CollectionFlowUI/helpers/get-current-step.ts (1)
3-8: LGTM!Clean and well-typed utility function.
packages/ui/src/components/organisms/Form/DynamicForm/controls/SubmitButton/SubmitButton.tsx (1)
24-24: LGTM! Proper integration of global disabled state.The changes correctly incorporate the global disabled state into the submit button's behavior, ensuring the loader displays when the form is globally disabled.
Also applies to: 72-74
apps/kyb-app/src/pages/CollectionFlow/versions/v2/components/organisms/CollectionFlowUI/helpers/get-next-not-completed-step.ts (1)
3-16: LGTM!Well-implemented utility for finding the next step requiring revision or edit.
apps/kyb-app/src/pages/CollectionFlow/versions/v2/components/organisms/CollectionFlowUI/CollectionFlowUI.tsx (1)
53-53: Good refactoring of submission logic!The consolidation of submission handling into a single function with explicit state management is a significant improvement. The addition of
isSubmittingstate and proper async handling enhances the user experience.Also applies to: 115-182, 202-202
apps/kyb-app/src/components/organisms/DynamicUI/StateManager/StateManager.tsx (2)
40-169: Well-structured implementation of dynamic state machine management!The refactoring to support dynamic state machine reinitialization is well-implemented. The component properly follows React best practices with appropriate use of hooks and memoization.
35-35: Let’s pull in thecreateWorkflowdefinition from the SDK to see how it appliesworkflowContext:#!/bin/bash # 1. Find the line number of createWorkflow in the SDK file line=$(rg -n "createWorkflow" sdks/workflow-browser-sdk/src/lib/workflow-browser-sdk.ts | head -n1 | cut -d: -f2) # 2. Dump the code around its definition sed -n "$((line-10)),$((line+50))p" sdks/workflow-browser-sdk/src/lib/workflow-browser-sdk.ts
| additionalContext, | ||
| ); | ||
| initialContext, | ||
| initialState: initialContext?.collectionFlow?.state?.currentStep!, |
There was a problem hiding this comment.
Replace non-null assertion with safe fallback.
The non-null assertion operator on the optional chain is risky and could cause runtime errors. Provide a fallback value for safety.
- initialState: initialContext?.collectionFlow?.state?.currentStep!,
+ initialState: initialContext?.collectionFlow?.state?.currentStep ?? 'initial',🤖 Prompt for AI Agents
In apps/kyb-app/src/components/organisms/DynamicUI/StateManager/StateManager.tsx
at line 58, replace the non-null assertion operator on
initialContext?.collectionFlow?.state?.currentStep! with a safe fallback value
to avoid potential runtime errors. Use a default value such as null or an
appropriate initial step when currentStep is undefined or null.
68b1a4f to
acd1e22
Compare
| const nextStep = isEditOrRevision | ||
| ? getNextRevisionOrEditStep(steps || [], page.stateName) | ||
| : getNextStep(steps || [], page.stateName); |
There was a problem hiding this comment.
What if it's neither of the statuses?
There was a problem hiding this comment.
App will follow finalSubmission logic and will be resolved to Thank you page
| if (!redirectUrls?.success) { | ||
| setIsSubmitting(false); | ||
| } else { | ||
| location.href = redirectUrls.success; |
There was a problem hiding this comment.
Why aren't we using a router's method for updating the URL?
There was a problem hiding this comment.
React Router not supporting 3rd party urls.
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Chores
Tests