Skip to content

[_]: feat/dialogs manager#22

Merged
xabg2 merged 3 commits intomasterfrom
feature/dialogs-manager
Mar 24, 2026
Merged

[_]: feat/dialogs manager#22
xabg2 merged 3 commits intomasterfrom
feature/dialogs-manager

Conversation

@xabg2
Copy link
Contributor

@xabg2 xabg2 commented Mar 24, 2026

Adding a new manager (context) to open/close dialogs from any component. We can also pass props to the desired dialog.

@xabg2 xabg2 requested a review from larryrider March 24, 2026 08:42
@xabg2 xabg2 self-assigned this Mar 24, 2026
@xabg2 xabg2 added the enhancement New feature or request label Mar 24, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 24, 2026

Warning

Rate limit exceeded

@xabg2 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 11 minutes and 19 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 94323c6c-b2eb-41f9-8114-166559a62830

📥 Commits

Reviewing files that changed from the base of the PR and between 2487691 and e4bc40e.

📒 Files selected for processing (1)
  • src/context/dialog-manager/useActionDialog.tsx
📝 Walkthrough

Walkthrough

Added a dialog-management system: types, a React context provider (DialogManagerProvider), a hook (useActionDialog), and a barrel export to manage opening/closing of named action dialogs and their associated data.

Changes

Cohort / File(s) Summary
Type Definitions
src/context/dialog-manager/types/index.ts
Added ActionDialog enum (compose-message, settings), ActionDialogState, DialogActionConfig, and ActionDialogContextProps defining the context shape.
Context Provider & Hook
src/context/dialog-manager/DialogManager.context.tsx, src/context/dialog-manager/useActionDialog.tsx
Added DialogManagerProvider that owns actionDialogs state with openDialog (optionally clears all first) and closeDialog. Added DialogManagerContext and useActionDialog hook exposing isDialogOpen, getDialogData, openDialog, and closeDialog.
Public API
src/context/dialog-manager/index.ts
Added barrel export re-exporting DialogManagerProvider, ActionDialog and DialogActionConfig types, and DialogManagerContext with useActionDialog for consumers.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'feat/dialogs manager' is vague and uses generic terminology without clearly conveying the specific functionality being added to the codebase. Use a more descriptive title that clearly explains the change, such as 'Add DialogManager context for managing dialog state and lifecycle' or 'Introduce DialogManagerProvider for centralized dialog management'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The description accurately relates to the changeset by explaining the purpose of the new dialog manager context for opening, closing, and passing props to dialogs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/dialogs-manager

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@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.

Warning

CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.

Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.

👉 Steps to fix this

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/context/dialog-manager/DialogManager.context.tsx`:
- Line 20: When closing a dialog in DialogManager.context.tsx the reducer is
writing [dialogKey]: { ...prevDialogs[dialogKey], isOpen: false, data: null }
which can create an ActionDialogState missing its required key property; update
the write to explicitly include key: dialogKey so the state entry always matches
the ActionDialogState shape (preserve existing spread of prevDialogs[dialogKey],
then set key: dialogKey, isOpen: false, data: null).

In `@src/context/dialog-manager/types/index.ts`:
- Line 17: The closeDialog type signature currently declares an unused optional
parameter config?: DialogActionConfig (closeDialog: (key: ActionDialog, config?:
DialogActionConfig) => void) while the implementation only accepts a single
dialogKey; remove the unused config parameter from the closeDialog type so its
declaration matches its implementation and the openDialog contract (i.e., change
the type to closeDialog: (key: ActionDialog) => void and update any callers to
pass only the dialog key or adjust callers that rely on the extra arg).

In `@src/context/dialog-manager/useActionDialog.tsx`:
- Line 9: Update the thrown Error message in useActionDialog to fix the typo and
make it actionable: change the message from "The context is not initialized.
Please it inside the provider" to a correct sentence such as "The context is not
initialized. Please use it inside the provider." Locate the throw new Error call
inside the useActionDialog function in
src/context/dialog-manager/useActionDialog.tsx and replace the message string
accordingly.
- Line 21: In getDialogData replace the logical OR with nullish coalescing so
you don't convert valid falsy values to null: change the return expression from
using "|| null" to "?? null" on the optional-chained access (i.e., update return
ctx.actionDialogs[key]?.data || null to use ?? instead) so only null/undefined
become null while preserving 0, false, or empty string; modify the function
getDialogData accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6da02ccc-43e2-41f9-ab93-1fa4798e11a3

📥 Commits

Reviewing files that changed from the base of the PR and between 4ae76a5 and f386a05.

📒 Files selected for processing (4)
  • src/context/dialog-manager/DialogManager.context.tsx
  • src/context/dialog-manager/index.ts
  • src/context/dialog-manager/types/index.ts
  • src/context/dialog-manager/useActionDialog.tsx

Copy link

@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.

Warning

CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.

Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.

👉 Steps to fix this

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/context/dialog-manager/useActionDialog.tsx`:
- Around line 12-17: The isDialogOpen callback uses the logical OR operator to
default missing dialog state but should use nullish coalescing for consistency
with getDialogData: update the implementation of isDialogOpen (the function
named isDialogOpen that reads ctx.actionDialogs[key]?.isOpen) to use the nullish
coalescing operator (??) instead of || so it mirrors getDialogData's pattern and
handles undefined/null consistently.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2c5e6a27-3438-4367-aece-b1bcdb66d3ac

📥 Commits

Reviewing files that changed from the base of the PR and between f386a05 and 2487691.

📒 Files selected for processing (3)
  • src/context/dialog-manager/DialogManager.context.tsx
  • src/context/dialog-manager/types/index.ts
  • src/context/dialog-manager/useActionDialog.tsx

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@xabg2 xabg2 merged commit d4197ad into master Mar 24, 2026
4 of 5 checks passed
@xabg2 xabg2 deleted the feature/dialogs-manager branch March 24, 2026 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants