forge42dev / remix-toast

Server side implementation of toast notifications in Remix
MIT License
189 stars 11 forks source link

Add additional toast options to ToastMessage #19

Open BatyaFeldman opened 5 months ago

BatyaFeldman commented 5 months ago

Thanks for this super handy library! Expanding the ToastMessage schema to accommodate additional options would enhance its compatibility with Sonner, react-toastify, and other toast libraries. Currently, any configuration beyond type, description, and message requires handling in the client, limiting customization when integrating the toaster at the root level.

Enabling ToastMessage to accept more options would provide finer control with client-side toast libraries by allowing us to do something like:

jsonWithSuccess(
      {data}, 
      {
         message: "Success",
         description, "Operation Successful",
         duration: 10000
         icon: ....
         onAutoClose: ....
     }
)
AlemTuzlak commented 1 month ago

I've added an optional duration, although I guess that doesn't fully solve this issue, some things can't be fully serialized through the network boundary like functions so onAutoClose could never work as you can't send functions through the network