Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

an.leclerc's avatar

Javascript inside livewire component is not reloaded after refresh

Hi,

I have a problem, inside my component I have javascript :

<script language="JavaScript" type="module">
        const inputElement = document.querySelector('input[id="files"]');
            
        const pond = FilePond.create(inputElement, {
            allowMultiple: true,
            server:{
                url: '{{ route('api.document.store') }}',
                headers: {
                    'X-CSRF-TOKEN': '{{ csrf_token() }}'
                },
            },
            allowRemove: false,
            allowRevert: false,
            allowProcess: false,
            fileMetadataObject: {
                dossier: '{{ $dossier->id }}',
            },
            onprocessfiles: () => {
                pond.removeFiles();
                @this.$refresh();
            }
        });
    </script>

But when component refresh, javascript is not refreshing.

How can i do

0 likes
14 replies
an.leclerc's avatar

@ghabe so I modified ma code, here is my view :

Here is my component :

It works, but files are saved twice and I don't know why.

an.leclerc's avatar

@ghabe wire:model isn't "live". @this.uploadMultiple upload photos but only in temporary directory, I'd like to cake files and rename it before insert into database, and I'd to do that without submit button but directly after selected files.

an.leclerc's avatar

@ghabe ok I understand. How catch uploaded files in component from uploadMultiple in view ?

Please or to participate in this conversation.