Skip to content

Fix alert provider reset#4

Merged
phev8 merged 4 commits intomainfrom
fix-alert-provider-reset
Feb 24, 2026
Merged

Fix alert provider reset#4
phev8 merged 4 commits intomainfrom
fix-alert-provider-reset

Conversation

@phev8
Copy link
Contributor

@phev8 phev8 commented Feb 24, 2026

No description provided.

@greptile-apps
Copy link

greptile-apps bot commented Feb 24, 2026

Greptile Summary

This PR fixes a critical state management bug in AlertDialogProvider by replacing useState with useRef for the resolver function, preventing stale closures and ensuring proper promise resolution. Additionally, it adds customizable button styling options (dismissButtonClassName and dismissButtonVariant) and correctly changes from AlertDialogAction to AlertDialogCancel to allow the dialog to close properly.

Key changes:

  • Replaced useState with useRef for resolver management to prevent stale closure issues
  • Changed from AlertDialogAction to AlertDialogCancel (which properly triggers dialog dismissal)
  • Added dismissButtonClassName and dismissButtonVariant props for button customization
  • Removed unnecessary setOptions({}) call in handleDismiss
  • Added second interactive example to demonstrate new styling features

Confidence Score: 5/5

  • This PR is safe to merge and fixes a critical bug
  • The changes fix a fundamental state management issue where useState caused stale closures with the resolver function. The switch to useRef is the correct solution. The addition of styling props is straightforward and well-implemented. The change from AlertDialogAction to AlertDialogCancel is semantically correct and necessary for proper dialog dismissal.
  • No files require special attention

Important Files Changed

Filename Overview
registry/radix-nova/alert-provider.tsx Fixed resolver state management by switching from useState to useRef, added customizable button styling props, and removed unnecessary setOptions({}) call
app/interactive-examples.tsx Added second alert example to demonstrate new styling options with no issues found

Last reviewed commit: 5f58e3d

@phev8 phev8 merged commit 5debbbe into main Feb 24, 2026
2 checks passed
@phev8 phev8 deleted the fix-alert-provider-reset branch February 24, 2026 14:01
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.

1 participant