Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 79fcba4

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

File tree

1 file changed

+11
-11
lines changed
Filter options

1 file changed

+11
-11
lines changed

‎packages/core/useEventSource/index.ts

Copy file name to clipboardExpand all lines: packages/core/useEventSource/index.ts
+11-11
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.