Skip to content

[Website] mention we can use hx-swap in SSE extension docs #2197

@flaviocopes

Description

@flaviocopes

Using the SSE extension I was a bit confused about how to append new messages at the end of a list, as by default the latest message is swapped with a newer one, searched on Discord before occurring to me I could use hx-swap.

https://discord.com/channels/725789699527933952/1171616558330679306

Maybe worth mentioning in the docs?

Got this docs update proposal if I can do a PR (saw it must be pre-approved via issues) flaviocopes@3480c1c


Swap Strategy

You can use any hx-swap strategy for the incoming messages, for example to append a message at the end of a list, add hx-swap='beforeend':

  <div
    hx-ext='sse'
    sse-connect='/event-source'
    sse-swap='message'
    hx-swap='beforeend'>
  </div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions