uuid fix
This commit is contained in:
parent
2272332191
commit
61f9933214
@ -1,5 +1,6 @@
|
|||||||
import React from "react";
|
import React from 'react';
|
||||||
import { useTendermintWebsocketContext } from "../contexts/websocket/tendermint-websocket-context";
|
import { useTendermintWebsocketContext } from '../contexts/websocket/tendermint-websocket-context';
|
||||||
|
import { uuid } from 'uuidv4';
|
||||||
|
|
||||||
export interface TendermintWebsocketQuery {
|
export interface TendermintWebsocketQuery {
|
||||||
query: string;
|
query: string;
|
||||||
@ -23,13 +24,12 @@ export const useTendermintWebsocket = function <T>(
|
|||||||
bufferSize?: number
|
bufferSize?: number
|
||||||
) {
|
) {
|
||||||
const { sendMessage, lastMessage } = useTendermintWebsocketContext();
|
const { sendMessage, lastMessage } = useTendermintWebsocketContext();
|
||||||
// @ts-ignore
|
const [id] = React.useState(uuid());
|
||||||
const [id] = React.useState(crypto.randomUUID());
|
|
||||||
const [messages, setMessages] = React.useState<MessageEvent<T>[]>([]);
|
const [messages, setMessages] = React.useState<MessageEvent<T>[]>([]);
|
||||||
|
|
||||||
const [subMsg] = React.useState({
|
const [subMsg] = React.useState({
|
||||||
jsonrpc: "2.0",
|
jsonrpc: '2.0',
|
||||||
method: "subscribe",
|
method: 'subscribe',
|
||||||
id,
|
id,
|
||||||
params: {
|
params: {
|
||||||
...message,
|
...message,
|
||||||
@ -37,7 +37,7 @@ export const useTendermintWebsocket = function <T>(
|
|||||||
});
|
});
|
||||||
const [unsubMsg] = React.useState({
|
const [unsubMsg] = React.useState({
|
||||||
...subMsg,
|
...subMsg,
|
||||||
method: "unsubscribe",
|
method: 'unsubscribe',
|
||||||
});
|
});
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
|
@ -25,7 +25,8 @@
|
|||||||
"react-dom": "17.0.2",
|
"react-dom": "17.0.2",
|
||||||
"react-use-websocket": "^3.0.0",
|
"react-use-websocket": "^3.0.0",
|
||||||
"regenerator-runtime": "0.13.7",
|
"regenerator-runtime": "0.13.7",
|
||||||
"tslib": "^2.0.0"
|
"tslib": "^2.0.0",
|
||||||
|
"uuidv4": "^6.2.12"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "7.12.13",
|
"@babel/core": "7.12.13",
|
||||||
|
21
yarn.lock
21
yarn.lock
@ -4422,6 +4422,11 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.6.tgz#250a7b16c3b91f672a24552ec64678eeb1d3a08d"
|
resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.6.tgz#250a7b16c3b91f672a24552ec64678eeb1d3a08d"
|
||||||
integrity sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==
|
integrity sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==
|
||||||
|
|
||||||
|
"@types/uuid@8.3.1":
|
||||||
|
version "8.3.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-8.3.1.tgz#1a32969cf8f0364b3d8c8af9cc3555b7805df14f"
|
||||||
|
integrity sha512-Y2mHTRAbqfFkpjldbkHGY8JIzRN6XqYRliG8/24FcHm2D2PwW24fl5xMRTVGdrb7iMrwCaIEbLWerGIkXuFWVg==
|
||||||
|
|
||||||
"@types/webpack-env@^1.16.0":
|
"@types/webpack-env@^1.16.0":
|
||||||
version "1.16.3"
|
version "1.16.3"
|
||||||
resolved "https://registry.yarnpkg.com/@types/webpack-env/-/webpack-env-1.16.3.tgz#b776327a73e561b71e7881d0cd6d34a1424db86a"
|
resolved "https://registry.yarnpkg.com/@types/webpack-env/-/webpack-env-1.16.3.tgz#b776327a73e561b71e7881d0cd6d34a1424db86a"
|
||||||
@ -17301,15 +17306,23 @@ uuid-browser@^3.1.0:
|
|||||||
resolved "https://registry.yarnpkg.com/uuid-browser/-/uuid-browser-3.1.0.tgz#0f05a40aef74f9e5951e20efbf44b11871e56410"
|
resolved "https://registry.yarnpkg.com/uuid-browser/-/uuid-browser-3.1.0.tgz#0f05a40aef74f9e5951e20efbf44b11871e56410"
|
||||||
integrity sha1-DwWkCu90+eWVHiDvv0SxGHHlZBA=
|
integrity sha1-DwWkCu90+eWVHiDvv0SxGHHlZBA=
|
||||||
|
|
||||||
|
uuid@8.3.2, uuid@^8.3.2:
|
||||||
|
version "8.3.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
|
||||||
|
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
|
||||||
|
|
||||||
uuid@^3.3.2:
|
uuid@^3.3.2:
|
||||||
version "3.4.0"
|
version "3.4.0"
|
||||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
|
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
|
||||||
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
|
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
|
||||||
|
|
||||||
uuid@^8.3.2:
|
uuidv4@^6.2.12:
|
||||||
version "8.3.2"
|
version "6.2.12"
|
||||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
|
resolved "https://registry.yarnpkg.com/uuidv4/-/uuidv4-6.2.12.tgz#e8c1d1d733c3fa4963d4610b8a3a09b4ec58ca96"
|
||||||
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
|
integrity sha512-UnN4ThIYWhv3ZUE8UwDnnCvh4JafCNu+sQkxmLyjCVwK3rjLfkg3DYiEv6oCMDIAIVEDP4INg4kX/C5hKaRzZA==
|
||||||
|
dependencies:
|
||||||
|
"@types/uuid" "8.3.1"
|
||||||
|
uuid "8.3.2"
|
||||||
|
|
||||||
v8-compile-cache@2.3.0, v8-compile-cache@^2.0.3:
|
v8-compile-cache@2.3.0, v8-compile-cache@^2.0.3:
|
||||||
version "2.3.0"
|
version "2.3.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user