petervandijck
petervandijck

Peter

@petervandijck

Laravel, AI and the climate emergency

10 Posts 10 Views

  • No matching results...
  • Searching...

/ 255

After three days, I figured out that if you use wire:stream() in Livewire, the only way (that I found) to update other bits of the UI before the stream starts, is to do another wire:stream() before that. Anything that uses events gets delayed until after all the streams are complete.

So I'm using View::make('..',)->render() to pre-render a piece of the UI, and then using stream() to update that on the frontend, before the next stream() starts.

1

152

Any Livewire experts here that might have thoughts on this? I am using wire:stream() for streaming a chat. *Before* the stream starts, I want to dispatch() something to update another Livewire component. However, Livewire's execution model means that dispatches only happen *after* the stream is complete.

I've tried a bunch of things, but no luck so far. Thoughts? Approaches?

108

I figured out a way to use the wonderfully designed toast messages in Flux in oldschool Laravel controllers. They are normally designed to be used from LiveWire, but I don't use LiveWire for every page, and I really wanted to use the toast messages everywhere.

Here are the docs, feel free to use or send thoughts!

This lets you dispatch a flux toast message from within an old fashioned Laravel controller.

github.com/petervandijck/oldschool-fluxtoasts



@calebporzio

122