Skip to content

An event is fired twice with data-on-signal-patch on a file input #1034

@kitharoidos

Description

@kitharoidos

Bug Report

I need to send an HTTP request to the backend whenever an image is uploaded, hence the following code:

<input data-bind="upload__profile-avatar.files" data-class-error="$app__error.upload__profile-avatar.files" data-on-signal-patch="console.log('Ahoj!'); @post('/profiles.add.avatar.upload')" data-on-signal-patch-filter="{include: /^upload__profile-avatar.files$/}" id="profile-avatar-input" type="file">

Unfortunately, the event is fired twice, that is, "Ahoj!" is printed twice to the console each time an image is uploaded.

Datastar Version

v1.0.0-RC.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions