Skip to content

Commit

Permalink
fix: SSE init problem (#2558)
Browse files Browse the repository at this point in the history
* fix: SSE init problem

Signed-off-by: licho <[email protected]>

* fix: SSE init problem

Signed-off-by: licho <[email protected]>

---------

Signed-off-by: licho <[email protected]>
  • Loading branch information
leechor authored Nov 21, 2023
1 parent 3a38d20 commit f4c0537
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion dinky-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
"screenfull": "^6.0.2",
"sql-formatter": "^13.1.0",
"styled-components": "^6.1.1",
"use-sse": "^2.0.1"
"use-sse": "^2.0.1",
"uuid": "^9.0.1"
},
"devDependencies": {
"@ant-design/pro-cli": "^3.0.1",
Expand Down
4 changes: 3 additions & 1 deletion dinky-web/src/models/Sse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import { postAll } from '@/services/api';
import { ErrorMessage } from '@/utils/messages';
import { useEffect, useRef, useState } from 'react';
import { v4 as uuidv4 } from 'uuid';


export type SseData = {
topic: string;
Expand All @@ -31,7 +33,7 @@ export type SubscriberData = {
};

export default () => {
const uuidRef = useRef<string>(crypto.randomUUID());
const uuidRef = useRef<string>(uuidv4());
const subscriberRef = useRef<SubscriberData[]>([]);
const [eventSource, setEventSource] = useState<EventSource>();

Expand Down

0 comments on commit f4c0537

Please sign in to comment.