Skip to content

Commit 79fcba4

Browse files
authored
fix(useEventSource): remove readonly to not be breaking (#4645)
1 parent f7ef074 commit 79fcba4

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

packages/core/useEventSource/index.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Fn } from '@vueuse/shared'
22
import type { MaybeRefOrGetter, Ref, ShallowRef } from 'vue'
33
import { isClient, toRef, tryOnScopeDispose } from '@vueuse/shared'
4-
import { ref as deepRef, shallowReadonly, shallowRef, watch } from 'vue'
4+
import { ref as deepRef, shallowRef, watch } from 'vue'
55
import { useEventListener } from '../useEventListener'
66

77
export type EventSourceStatus = 'CONNECTING' | 'OPEN' | 'CLOSED'
@@ -55,23 +55,23 @@ export interface UseEventSourceReturn<Events extends string[], Data = any> {
5555
* Reference to the latest data received via the EventSource,
5656
* can be watched to respond to incoming messages
5757
*/
58-
readonly data: Readonly<ShallowRef<Data>>
58+
data: ShallowRef<Data>
5959

6060
/**
6161
* The current state of the connection, can be only one of:
6262
* 'CONNECTING', 'OPEN' 'CLOSED'
6363
*/
64-
readonly status: Readonly<ShallowRef<EventSourceStatus>>
64+
status: ShallowRef<EventSourceStatus>
6565

6666
/**
6767
* The latest named event
6868
*/
69-
readonly event: Readonly<ShallowRef<Events[number] | null>>
69+
event: ShallowRef<Events[number] | null>
7070

7171
/**
7272
* The current error
7373
*/
74-
readonly error: Readonly<ShallowRef<Event | null>>
74+
error: ShallowRef<Event | null>
7575

7676
/**
7777
* Closes the EventSource connection gracefully.
@@ -92,7 +92,7 @@ export interface UseEventSourceReturn<Events extends string[], Data = any> {
9292
* The last event ID string, for server-sent events.
9393
* @see https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent/lastEventId
9494
*/
95-
readonly lastEventId: Readonly<ShallowRef<string | null>>
95+
lastEventId: ShallowRef<string | null>
9696
}
9797

9898
function resolveNestedOptions<T>(options: T | true): T {
@@ -214,12 +214,12 @@ export function useEventSource<Events extends string[], Data = any>(
214214

215215
return {
216216
eventSource,
217-
event: shallowReadonly(event),
218-
data: shallowReadonly(data),
219-
status: shallowReadonly(status),
220-
error: shallowReadonly(error),
217+
event,
218+
data,
219+
status,
220+
error,
221221
open,
222222
close,
223-
lastEventId: shallowReadonly(lastEventId),
223+
lastEventId,
224224
}
225225
}

0 commit comments

Comments
 (0)