You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I've have accidentally passed parameters that don't match Component Parameter Types into the ModalParameters object because there are no Type constraints.
Describe the solution you'd like
Create a generic Modal Parameters class like:
As a note it is AddParameter and not Add to maintain backwards compatibility and to get the complier type safety. I originally had the method as an overload of Add but then you wouldn't get the complier error thus defeating the purpose.
This would be a really nice addition and helps a lot to clean up the code.
It helps especially in the case of passing EventHandlers or Functions to the modal, for example if i want an async submit action to be performend before closing the modal:
This saves a lot of typing (especially when doing so in the dreadful razor editor ...)
Since I am using a lot of modals for async updating data via REST API and i always want to wait for a response before closing I do encounter this problem often in my application.
@thepigeonfighter i did implement the same thing on my end and did not have any issues with the Method being named Add() as well. Since the first parameter is an expression and not a string the compiler can pick the correct overload.
we've written a basically-identical extension for our project at work. however: I wouldn't want such a method to throw an ArgumentNullException for null parameter values. there are many times we have optional (nullable) parameters in our modals.
Is your feature request related to a problem? Please describe.
I've have accidentally passed parameters that don't match Component Parameter Types into the ModalParameters object because there are no Type constraints.
Describe the solution you'd like
Create a generic Modal Parameters class like:
As a note it is
AddParameter
and notAdd
to maintain backwards compatibility and to get the complier type safety. I originally had the method as an overload ofAdd
but then you wouldn't get the complier error thus defeating the purpose.Usage
The text was updated successfully, but these errors were encountered: