Skip to content

Commit

Permalink
Bug Fixed: Tel Input re-rendering after component update in Livewire 3.
Browse files Browse the repository at this point in the history
  • Loading branch information
victorybiz committed Sep 26, 2023
1 parent 3916d2a commit b4540b6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion public/js/laravel-tel-input.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions resources/js/laravel-tel-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,17 +278,23 @@

// Listen to the document events and re-render the tel inputs
document.addEventListener("DOMContentLoaded", function() {
renderTelInput();
setTimeout(function () {
renderTelInput();
}, 5);

// user dispatched browser events to re-render the tel inputs
document.addEventListener("telDOMChanged", function() {
renderTelInput();
setTimeout(function () {
renderTelInput();
}, 5);
});

// Livewire event hook
if (window.Livewire) {
window.Livewire.hook('component.initialized', component => {
renderTelInput();
setTimeout(function () {
renderTelInput();
}, 5);
});
}
});
Expand Down

0 comments on commit b4540b6

Please sign in to comment.