Loading indicator when showing/hiding dependent fields via select

Hi all I've got a form with several hidden sections I switch between using a 'type' select field. The sections have ->hidden(fn (Get $get) => $get('type') !== ......) on them. There's a noticeable delay after selecting an option before the correct section appears. The server is in Europe and I'm in Australia so the latency is pretty high. Moving servers isn't an option unfortunately. I'd like to add a loading indicator to improve the UX. Ideally, I'd like to remove the currently displayed section as soon as an option is selected (without waiting for the backend request) and show a loading indicator until the new section appears. Which probably means doing something client-side with Alpine... Any suggestions on how I could do that? Thanks!
5 Replies
binaryfire
binaryfireOP15mo ago
Anyone?
toeknee
toeknee15mo ago
It's really easy
binaryfire
binaryfireOP15mo ago
@toeknee Thanks, adding an indicator using View was exactly what I needed. Had to use wire.loading.class.remove="hidden" to get it to work. Adding visible wasn't overriding hidden
toeknee
toeknee15mo ago
Great stuff
Want results from more Discord servers?
Add your server