solid-toast icon indicating copy to clipboard operation
solid-toast copied to clipboard

Lazy Loading

Open goenning opened this issue 3 years ago • 3 comments

Is it possible to lazy load this package?

My use case is that most users will never see a toast, so I don’t want them to pay the price of extra JS unnecessarily

it’s pretty easy to lazy load the “toast” object, but the problem is the Toaster container. I’ll try do It by dynamically attaching it to the DOM on first use (maybe using Solid Portal?), but in case someone already solved this, please share 😊

goenning avatar Aug 21 '22 21:08 goenning

I apologise I haven't had time to look at this. Are you aware of any other UI libraries leveraging lazy loading? I would love to take a look and see if we can get it working with Solid Toast

ardeora avatar Aug 26 '22 15:08 ardeora

React Toastify: https://github.com/fkhadra/react-toastify/issues/276

I did that in 2018, so things might have changed/improved since

goenning avatar Aug 26 '22 21:08 goenning

Ooh awesome! This is a really helpful example. I'll take a look and follow back with ideas.

ardeora avatar Aug 27 '22 16:08 ardeora