vueuse / vueuse

Collection of essential Vue Composition Utilities for Vue 2 and 3
https://vueuse.org
MIT License
18.99k stars 2.39k forks source link

`useEventSource`: Return `id` besides `event` and `data` #3974

Closed max06 closed 6 days ago

max06 commented 2 weeks ago

Clear and concise description of the problem

With the current implementation, it's not possible to react to repeating events/data more than once, for example to ping-events without data. Following the docs, the id is part of the event, and would allow reacting to all messages.

Suggested solution

Add id besides the existing event and data-export.

Alternative

No response

Additional context

More a question... since watch requires ticks between changes to not miss-out on updates, does useEventSource make sure to pass all messages along? Is there any chance we could miss messages if, let's say our source burst sends 100 updates at once?

Validations