From 917e34ef7aa7b5e14d34e0c764ad5a87bb1a37e9 Mon Sep 17 00:00:00 2001 From: Daria Terekhova Date: Fri, 6 Dec 2024 18:55:55 +0200 Subject: [PATCH 1/5] crash fixed --- src/components/comparison/comparison-side/comparison-side.tsx | 1 + src/pages/debug-app/debug-app.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/src/components/comparison/comparison-side/comparison-side.tsx b/src/components/comparison/comparison-side/comparison-side.tsx index b0b404c3..b009dcf2 100644 --- a/src/components/comparison/comparison-side/comparison-side.tsx +++ b/src/components/comparison/comparison-side/comparison-side.tsx @@ -320,6 +320,7 @@ export const ComparisonSide = ({ .map((sublayer) => ({ id: sublayer.id, url: sublayer.url, + fetch: sublayer.fetch, token: sublayer.token, type: sublayer.type ?? TilesetType.I3S, })); diff --git a/src/pages/debug-app/debug-app.tsx b/src/pages/debug-app/debug-app.tsx index 1db04e7f..062d4a8a 100644 --- a/src/pages/debug-app/debug-app.tsx +++ b/src/pages/debug-app/debug-app.tsx @@ -192,6 +192,7 @@ export const DebugApp = () => { .map((sublayer) => ({ id: sublayer.id, url: sublayer.url, + fetch: sublayer.fetch, token: sublayer.token, type: sublayer.type ?? TilesetType.I3S, })); From 22ebd788bfe1a0468bf1a78a5e8dcae8118955a1 Mon Sep 17 00:00:00 2001 From: Daria Terekhova Date: Mon, 9 Dec 2024 15:27:28 +0200 Subject: [PATCH 2/5] two file uplosders fix --- src/components/upload-panel/upload-panel.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/upload-panel/upload-panel.tsx b/src/components/upload-panel/upload-panel.tsx index 051c8df8..388a5caf 100644 --- a/src/components/upload-panel/upload-panel.tsx +++ b/src/components/upload-panel/upload-panel.tsx @@ -5,11 +5,9 @@ import { UploadPanelItem } from "./upload-panel-item"; import UploadIcon from "../../../public/icons/upload.svg"; import { Layout } from "../../utils/enums"; -import { useRef, useState } from "react"; +import { useMemo, useRef, useState } from "react"; import { useAppLayout } from "../../utils/hooks/layout"; -const UPLOAD_INPUT_ID = "upload-file-input"; - const FileInteractionContainer = styled.label` box-sizing: border-box; display: flex; @@ -83,6 +81,8 @@ export const UploadPanel = ({ onFileUploaded, onFileEvent, }: UploadProps) => { + const UPLOAD_INPUT_ID = useMemo(() => `upload-file-input${crypto.randomUUID()}`, []); + const layout = useAppLayout(); const [dragActive, setDragActive] = useState(false); const [fileUploaded, setFileUploaded] = useState(""); From c6f3027f85e5b5d004b1e88fe95d7e4cb3431a74 Mon Sep 17 00:00:00 2001 From: Daria Terekhova Date: Mon, 9 Dec 2024 20:57:58 +0200 Subject: [PATCH 3/5] Tests fix --- src/components/bookmarks-panel/bookmarks-panel.tsx | 6 ++++++ src/components/layers-panel/insert-panel/insert-panel.tsx | 6 ++++++ src/components/upload-panel/upload-panel.spec.tsx | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/src/components/bookmarks-panel/bookmarks-panel.tsx b/src/components/bookmarks-panel/bookmarks-panel.tsx index 0902b142..6246e962 100644 --- a/src/components/bookmarks-panel/bookmarks-panel.tsx +++ b/src/components/bookmarks-panel/bookmarks-panel.tsx @@ -42,6 +42,12 @@ enum PopoverType { none, } +Object.defineProperty(globalThis, "crypto", { + value: { + randomUUID: () => "", + }, +}); + const Container = styled.div` position: absolute; background: ${({ theme }) => theme.colors.mainCanvasColor}; diff --git a/src/components/layers-panel/insert-panel/insert-panel.tsx b/src/components/layers-panel/insert-panel/insert-panel.tsx index b05da128..fffeb647 100644 --- a/src/components/layers-panel/insert-panel/insert-panel.tsx +++ b/src/components/layers-panel/insert-panel/insert-panel.tsx @@ -27,6 +27,12 @@ import { import { UploadPanel } from "../../upload-panel/upload-panel"; import { getLayerUrl } from "../../../utils/layer-utils"; +Object.defineProperty(globalThis, "crypto", { + value: { + randomUUID: () => "", + }, +}); + const NO_NAME_ERROR = "Please enter name"; const INVALID_URL_ERROR = "Invalid URL"; diff --git a/src/components/upload-panel/upload-panel.spec.tsx b/src/components/upload-panel/upload-panel.spec.tsx index 0a988cc7..0d1c6d30 100644 --- a/src/components/upload-panel/upload-panel.spec.tsx +++ b/src/components/upload-panel/upload-panel.spec.tsx @@ -15,6 +15,12 @@ jest.mock("@hyperjump/json-schema", () => ({ ), })); +Object.defineProperty(globalThis, "crypto", { + value: { + randomUUID: () => "", + }, +}); + const onCancel = jest.fn(); const onFileUploaded = jest.fn(); From 435f8acd49a8657181133530b7330cb9f52bc4cb Mon Sep 17 00:00:00 2001 From: Daria Terekhova Date: Thu, 12 Dec 2024 15:59:23 +0200 Subject: [PATCH 4/5] review fix --- src/components/bookmarks-panel/bookmarks-panel.spec.tsx | 6 ++++++ src/components/bookmarks-panel/bookmarks-panel.tsx | 6 ------ .../layers-panel/insert-panel/insert-panel.spec.tsx | 7 +++++++ src/components/layers-panel/insert-panel/insert-panel.tsx | 6 ------ 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/components/bookmarks-panel/bookmarks-panel.spec.tsx b/src/components/bookmarks-panel/bookmarks-panel.spec.tsx index 08cdf267..a1364469 100644 --- a/src/components/bookmarks-panel/bookmarks-panel.spec.tsx +++ b/src/components/bookmarks-panel/bookmarks-panel.spec.tsx @@ -11,6 +11,12 @@ jest.mock("../../utils/hooks/layout"); const dragAndDropText = "Drag and drop your json file here"; +Object.defineProperty(globalThis, "crypto", { + value: { + randomUUID: () => "", + }, +}); + const TEST_BOOKMARKS = [ { id: "testId1", diff --git a/src/components/bookmarks-panel/bookmarks-panel.tsx b/src/components/bookmarks-panel/bookmarks-panel.tsx index 6246e962..0902b142 100644 --- a/src/components/bookmarks-panel/bookmarks-panel.tsx +++ b/src/components/bookmarks-panel/bookmarks-panel.tsx @@ -42,12 +42,6 @@ enum PopoverType { none, } -Object.defineProperty(globalThis, "crypto", { - value: { - randomUUID: () => "", - }, -}); - const Container = styled.div` position: absolute; background: ${({ theme }) => theme.colors.mainCanvasColor}; diff --git a/src/components/layers-panel/insert-panel/insert-panel.spec.tsx b/src/components/layers-panel/insert-panel/insert-panel.spec.tsx index fd20dc26..e3118264 100644 --- a/src/components/layers-panel/insert-panel/insert-panel.spec.tsx +++ b/src/components/layers-panel/insert-panel/insert-panel.spec.tsx @@ -10,6 +10,13 @@ import "@testing-library/jest-dom"; const onInsertMock = jest.fn(); const onCancelMock = jest.fn(); +Object.defineProperty(globalThis, "crypto", { + value: { + randomUUID: () => "", + }, +}); + + const callRender = ( renderFunc, props = {}, diff --git a/src/components/layers-panel/insert-panel/insert-panel.tsx b/src/components/layers-panel/insert-panel/insert-panel.tsx index fffeb647..b05da128 100644 --- a/src/components/layers-panel/insert-panel/insert-panel.tsx +++ b/src/components/layers-panel/insert-panel/insert-panel.tsx @@ -27,12 +27,6 @@ import { import { UploadPanel } from "../../upload-panel/upload-panel"; import { getLayerUrl } from "../../../utils/layer-utils"; -Object.defineProperty(globalThis, "crypto", { - value: { - randomUUID: () => "", - }, -}); - const NO_NAME_ERROR = "Please enter name"; const INVALID_URL_ERROR = "Invalid URL"; From 0064a623c9a2da85953545733cba08557d66ba6f Mon Sep 17 00:00:00 2001 From: Daria Terekhova Date: Thu, 12 Dec 2024 16:02:16 +0200 Subject: [PATCH 5/5] lint fix --- src/components/layers-panel/insert-panel/insert-panel.spec.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/layers-panel/insert-panel/insert-panel.spec.tsx b/src/components/layers-panel/insert-panel/insert-panel.spec.tsx index e3118264..0b9e6849 100644 --- a/src/components/layers-panel/insert-panel/insert-panel.spec.tsx +++ b/src/components/layers-panel/insert-panel/insert-panel.spec.tsx @@ -16,7 +16,6 @@ Object.defineProperty(globalThis, "crypto", { }, }); - const callRender = ( renderFunc, props = {},