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

[FEAT] useModalForm Expose a SetAction for RefineCoreProps #6451

Open
aress31 opened this issue Nov 3, 2024 · 7 comments · May be fixed by #6487
Open

[FEAT] useModalForm Expose a SetAction for RefineCoreProps #6451

aress31 opened this issue Nov 3, 2024 · 7 comments · May be fixed by #6487
Assignees
Labels
enhancement New feature or request up for grabs

Comments

@aress31
Copy link

aress31 commented Nov 3, 2024

Is your feature request related to a problem? Please describe.

Could you implement a setAction function to programmatically change the action after the modal has been initialized? For example:

const editModalProps = useModalForm({
  refineCoreProps: { action: "edit" },
  warnWhenUnsavedChanges: true,
});
const showModalProps = useModalForm({
  refineCoreProps: { action: "show" },
});

console.log(editModalProps);

Describe alternatives you've considered

No response

Additional context

No response

Describe the thing to improve

I need to change the action based on the button pressed, either "create" or "edit," since the same FormComponent will be used for both.

@aress31 aress31 added the enhancement New feature or request label Nov 3, 2024
@aliemir
Copy link
Member

aliemir commented Nov 5, 2024

Hey @aress31, thank you for reporting this! Currently the show method returned from the useModalForm accepts id to be passed while opening the modal. I think this can be modified to also accept resource and action 🤔 Let us know if you can work on this one. We'd love to see your contribution! 🚀

@aress31
Copy link
Author

aress31 commented Nov 5, 2024

I only need the basic functionality from useModal, not the additional features from useModalForm. I ended up creating a callback method that sets both setId and setAction, but having this support built-in would be very useful.

@BatuhanW
Copy link
Member

BatuhanW commented Nov 8, 2024

We are open to contributions for this issue from the community.

@aress31
Copy link
Author

aress31 commented Nov 8, 2024

@aliemir it could be better to have a general/all-purposeful prop like meta to allow passing up any relevant data for the Modal. This approach would accommodate any use cases.

@BatuhanW
Copy link
Member

Hello @aress31 would you like to work on this?

@aress31
Copy link
Author

aress31 commented Nov 12, 2024

Kindly assign someone else.

@AYUSHKUMARGUPTA
Copy link

AYUSHKUMARGUPTA commented Nov 13, 2024

I have created the PR for the provided issue #6487

Please review and if this works, Please assign the issue to me

@BatuhanW FYI

@BatuhanW BatuhanW linked a pull request Nov 19, 2024 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request up for grabs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants