Skip to content

Dispatch datastar-fetch events from the element that creates them #1077

@gazpachoking

Description

@gazpachoking

Feature Request

The ergonomics of using datastar-fetch events would be improved quite a bit by dispatching them from the element where they are created. Currently you have to do a check in any handler for the event that evt.detail.el == el to filter instead of using the standard event bubbling of the html spec.

This was done previously in #761, but was later reverted due to #802, where streams would stop working after the element that initiated them was removed from the page. This should no longer be a concern though, as it will be a feature that the stream is cancelled when the element is removed rather than a bug starting in RC.6.

Datastar Version

v1.0.0-RC.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions