Skip to content

@get not aborting #1072

@goertzenator

Description

@goertzenator

Bug Report

The div below will freely run additional @gets without aborting existing ones. The @get in question provides and infinite stream of events, so eventually I get many overlapping events streams in flight. The documentation says that I should get "auto" abort behavior such that an existing fetch will be aborted whenever a new one on the same element is issued.

<div class="d-flex flex-column" 
     data-persist-traces__session="" 
     data-persist="{include: /^port$/}" 
     data-signals="{port: 1, loadedPort: -1}" 
     data-effect="($port != $loadedPort) &amp;&amp; ($loadedPort = $port, @get('/h/traces/updates/' + $port))">
    
     ...

A slightly older version of this code (below) does abort properly, but it has the problem of the data-effect code being invoked superfluously when $port has not actually changed. (Hence the change-checking logic in the above version).

<div class="d-flex flex-column" 
     data-persist-traces__session="" 
     data-persist="{include: /^port$/}" 
     data-signals="{port: 1, loadedPort: -1}" 
     data-effect="@get('/h/traces/updates/' + $port)">
     
     ...

Datastar Version

v1.0.0_rc5

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