wireui / wireui

TallStack UI components
https://v1.wireui.dev
MIT License
1.37k stars 167 forks source link

Confirm Directive after wire:navigate #818

Open hdahon opened 5 months ago

hdahon commented 5 months ago

Describe the bug The Confirm Directive does not work anymore after a wire:navigate, the click on the button do nothing.

<x-button label="Delete" x-on:confirm="{ title: 'Sure Delete?', icon: 'warning', method: 'delete', params: 1 }" />

Dependencies

Desktop (If applicable, please complete the following information):

hdahon commented 5 months ago

I managed to make it work by adding the event livewire:navigated in /wireui/wireui/ts/directives/confirm.ts

document.addEventListener('livewire:navigated', () => { 
  initialize(document.body)
})

But that might not be the best solution ?