Skip to content
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

[docs] Specify that dialogs payload is not restricted to string type #4373

Closed
wants to merge 1 commit into from

Conversation

prakhargupta1
Copy link
Member

No description provided.

@prakhargupta1 prakhargupta1 added the docs Improvements or additions to the documentation label Nov 6, 2024
@prakhargupta1 prakhargupta1 linked an issue Nov 6, 2024 that may be closed by this pull request
@@ -8,7 +8,7 @@ import DialogActions from '@mui/material/DialogActions';
import TextField from '@mui/material/TextField';
import Stack from '@mui/material/Stack';

function MyCustomDialog({ payload, open, onClose }: DialogProps<string>) {
function MyCustomDialog({ payload, open, onClose }: DialogProps<any>) {
Copy link
Member

@Janpot Janpot Nov 6, 2024

Choose a reason for hiding this comment

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

no, we need to advertise strong typing. this is what makes it safe to use.

Suggested change
function MyCustomDialog({ payload, open, onClose }: DialogProps<any>) {
function MyCustomDialog({ payload, open, onClose }: DialogProps<string>) {

@bharatkashyap
Copy link
Member

bharatkashyap commented Nov 6, 2024

I think we need to add an example that makes this advanced usage clear. It will demonstrate how different form components can be passed to the same dialog component through the payload prop based on user choice.

We can add it to an "Advanced" section in the dialog docs page or create a Recipes page and move this there. What do you think about that?

#4375

@prakhargupta1
Copy link
Member Author

prakhargupta1 commented Nov 6, 2024

What do you think about that?

The advanced example demonstrates this very well.👍 Thanks for adding it. Feel to close this PR when the other one is approved.

@prakhargupta1 prakhargupta1 deleted the payload branch November 7, 2024 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

useDialogs Make Payload a Node Rather than a String
3 participants