From 61f99332145f517c19d782d7f4d48ed11dc3bd7c Mon Sep 17 00:00:00 2001 From: Dexter Date: Fri, 18 Feb 2022 10:45:28 +0000 Subject: [PATCH] uuid fix --- .../app/hooks/use-tendermint-websocket.tsx | 14 ++++++------- package.json | 3 ++- yarn.lock | 21 +++++++++++++++---- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/apps/explorer/src/app/hooks/use-tendermint-websocket.tsx b/apps/explorer/src/app/hooks/use-tendermint-websocket.tsx index 07411f23e..6d9bc4ef2 100644 --- a/apps/explorer/src/app/hooks/use-tendermint-websocket.tsx +++ b/apps/explorer/src/app/hooks/use-tendermint-websocket.tsx @@ -1,5 +1,6 @@ -import React from "react"; -import { useTendermintWebsocketContext } from "../contexts/websocket/tendermint-websocket-context"; +import React from 'react'; +import { useTendermintWebsocketContext } from '../contexts/websocket/tendermint-websocket-context'; +import { uuid } from 'uuidv4'; export interface TendermintWebsocketQuery { query: string; @@ -23,13 +24,12 @@ export const useTendermintWebsocket = function ( bufferSize?: number ) { const { sendMessage, lastMessage } = useTendermintWebsocketContext(); - // @ts-ignore - const [id] = React.useState(crypto.randomUUID()); + const [id] = React.useState(uuid()); const [messages, setMessages] = React.useState[]>([]); const [subMsg] = React.useState({ - jsonrpc: "2.0", - method: "subscribe", + jsonrpc: '2.0', + method: 'subscribe', id, params: { ...message, @@ -37,7 +37,7 @@ export const useTendermintWebsocket = function ( }); const [unsubMsg] = React.useState({ ...subMsg, - method: "unsubscribe", + method: 'unsubscribe', }); React.useEffect(() => { diff --git a/package.json b/package.json index e72eafc1f..22533a1e5 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,8 @@ "react-dom": "17.0.2", "react-use-websocket": "^3.0.0", "regenerator-runtime": "0.13.7", - "tslib": "^2.0.0" + "tslib": "^2.0.0", + "uuidv4": "^6.2.12" }, "devDependencies": { "@babel/core": "7.12.13", diff --git a/yarn.lock b/yarn.lock index d4cb53680..8d6596144 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4422,6 +4422,11 @@ resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.6.tgz#250a7b16c3b91f672a24552ec64678eeb1d3a08d" 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": version "1.16.3" 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" 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: version "3.4.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== -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== +uuidv4@^6.2.12: + version "6.2.12" + resolved "https://registry.yarnpkg.com/uuidv4/-/uuidv4-6.2.12.tgz#e8c1d1d733c3fa4963d4610b8a3a09b4ec58ca96" + 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: version "2.3.0"