Skip to content

Conversation

@chesterkmr
Copy link
Contributor

@chesterkmr chesterkmr commented Jun 22, 2025

Summary by CodeRabbit

  • New Features

    • Added support for hiding specific document types from the backoffice interface.
  • Refactor

    • Improved performance and reliability of document schema loading in the backoffice.
    • Enhanced dropdown menus to exclude hidden options and display selected values more clearly.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 22, 2025

Walkthrough

The changes introduce a new optional property, hiddenIn, to the document schema, specifically allowing the value 'backoffice'. The document adapter logic is updated to memoize the document schemas and to filter out schemas marked as hidden in the backoffice. Dropdown options handling is adjusted to respect this hidden status. Additionally, a data-migrations subproject commit reference is updated.

Changes

File(s) Change Summary
apps/backoffice-v2/src/domains/documents/hooks/adapters/useWorkflowDocumentsAdapter/*.tsx Memoized documentsSchemas with useMemo depending on issuerCountryCode and workflow; no logic changes.
apps/backoffice-v2/src/pages/Entity/hooks/useEntityLogic/utils.ts Extended document destructuring to include hiddenIn; added hidden boolean to dropdown options based on hiddenIn.
apps/backoffice-v2/src/lib/blocks/components/EditableDetails/* Added hidden property to dropdown option type; filtered out hidden options from rendering; display selected option label.
packages/common/src/schemas/documents/schemas/documents-schema.ts Added optional hiddenIn?: 'backoffice' property to document schema objects.
services/workflows-service/prisma/data-migrations Updated subproject commit reference.

Suggested reviewers

  • Omri-Levy
  • tomer-shvadron

Poem

In the warren of code, a schema appears,
With secrets to hide from backoffice ears.
Memoized and filtered, the docs hop along,
While migrations update with a versioned song.
🐇✨
The rabbit approves, with a twitch of delight—
Hidden or shown, the code feels just right!

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@changeset-bot
Copy link

changeset-bot bot commented Jun 24, 2025

⚠️ No Changeset found

Latest commit: afe1936

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 263f99b and afe1936.

📒 Files selected for processing (4)
  • apps/backoffice-v2/src/domains/documents/hooks/adapters/useWorkflowDocumentsAdapter/useWorkflowDocumentsAdapter.tsx (1 hunks)
  • apps/backoffice-v2/src/lib/blocks/components/EditableDetails/EditableDetails.tsx (1 hunks)
  • apps/backoffice-v2/src/lib/blocks/components/EditableDetails/types.ts (1 hunks)
  • apps/backoffice-v2/src/pages/Entity/hooks/useEntityLogic/utils.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/backoffice-v2/src/domains/documents/hooks/adapters/useWorkflowDocumentsAdapter/useWorkflowDocumentsAdapter.tsx
🧰 Additional context used
📓 Path-based instructions (1)
`apps/backoffice-v2/**/*.{ts,tsx}`: Use functional components with TypeScript. Implement smart/dumb component pattern. Place components in feature-based directories. Use compound c...

apps/backoffice-v2/**/*.{ts,tsx}: Use functional components with TypeScript.
Implement smart/dumb component pattern.
Place components in feature-based directories.
Use compound components for complex UIs.
Follow atomic design principles.
Use React Query for server state and API calls.
Use Context for shared state.
Implement state machines for complex flows.
Use local state for UI-only state.
Follow unidirectional data flow.
Use strict TypeScript configuration.
Define interfaces for all props.
Use discriminated unions for state.
Leverage type inference.
Use Radix UI for accessible components.
Implement proper ARIA attributes.
Follow consistent styling patterns.
Use composition over inheritance.
Keep components small and focused.
Use React Hook Form for forms.
Implement Zod for validation.
Handle form submission states.
Show validation feedback.
Use controlled inputs when needed.
Implement proper loading states for data fetching.
Handle error states gracefully.
Cache responses appropriately.
Type API responses.
Use error boundaries.
Implement fallback UI.
Handle async errors.
Show user-friendly error messages.
Log errors appropriately.
Use React.memo wisely.
Implement proper code splitting.
Use lazy loading for routes.
Optimize re-renders.
Profile performance regularly.
Write unit tests for components.
Use React Testing Library.
Mock external dependencies in tests.
Maintain good test coverage.
Follow feature-based organization.
Use index files for exports.
Keep related files together.
Use consistent naming.
Implement barrel exports.
Use Tailwind CSS for styling.
Follow utility-first approach for styling.
Use CSS variables for theming.
Keep styles maintainable.
Use CSS modules when needed.
Document complex logic.
Write clear component documentation.
Keep documentation up to date.
Use JSDoc when helpful.
Follow ESLint rules.
Use consistent formatting.
Write clear variable names.
Keep functions pure.
Use meaningful types.
Validate user input.
Implement proper authentication.
Handle sensitive data carefully.
Follow security best practices.
Use HTTPS for API calls.
Follow WCAG guidelines for accessibility.
Use semantic HTML.
Test with screen readers.
Ensure keyboard navigation.
Provide proper focus management.

  • apps/backoffice-v2/src/lib/blocks/components/EditableDetails/types.ts
  • apps/backoffice-v2/src/lib/blocks/components/EditableDetails/EditableDetails.tsx
  • apps/backoffice-v2/src/pages/Entity/hooks/useEntityLogic/utils.ts
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: lint
  • GitHub Check: test_linux
🔇 Additional comments (6)
apps/backoffice-v2/src/lib/blocks/components/EditableDetails/types.ts (1)

6-6: LGTM! Clean type extension.

The optional hidden property addition is well-designed and maintains backward compatibility while enabling the dropdown filtering functionality.

apps/backoffice-v2/src/pages/Entity/hooks/useEntityLogic/utils.ts (3)

1-1: Good cleanup of unused imports.

Removing the unused AnyArray import keeps the code clean and follows good maintenance practices.


33-33: Clean destructuring addition.

Adding hiddenIn to the destructuring follows the existing pattern and maintains code consistency.


54-54: Correct implementation of hidden property logic.

The boolean conversion hiddenIn === 'backoffice' correctly maps the schema property to the dropdown option's hidden state, enabling proper filtering in the UI.

apps/backoffice-v2/src/lib/blocks/components/EditableDetails/EditableDetails.tsx (2)

396-396: Clean destructuring pattern for hidden property.

The destructuring follows existing patterns and maintains code consistency.


404-404: Correct implementation of conditional rendering.

The early return pattern for hidden options is the right approach for conditional rendering in React and efficiently prevents hidden options from being rendered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants