From 9ccc6b3290d7308648a0269e8e5cb0e0f4253e86 Mon Sep 17 00:00:00 2001 From: Amelia Wattenbeger Date: Thu, 2 Dec 2021 11:11:32 -0500 Subject: [PATCH] minimap - use onNavigateToPath prop --- src/blocks/folder-blocks/minimap/index.tsx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/blocks/folder-blocks/minimap/index.tsx b/src/blocks/folder-blocks/minimap/index.tsx index dc04bd4..ddd6f79 100644 --- a/src/blocks/folder-blocks/minimap/index.tsx +++ b/src/blocks/folder-blocks/minimap/index.tsx @@ -1,10 +1,10 @@ -import { useEffect, useMemo, useState } from "react"; +import { useMemo } from "react"; // @ts-ignore import { Tree } from "./Tree.jsx" import { FolderBlockProps, getNestedFileTree, } from "@githubnext/utils"; export default function (props: FolderBlockProps) { - const { tree } = props; + const { tree, onNavigateToPath } = props; const data = useMemo(() => { const nestedTree = getNestedFileTree(tree)[0] @@ -22,12 +22,7 @@ export default function (props: FolderBlockProps) { { - if ('URLSearchParams' in window) { - var searchParams = new URLSearchParams(window.location.search); - searchParams.set("path", path); - var newRelativePathQuery = window.location.pathname + '?' + searchParams.toString(); - history.pushState(null, '', newRelativePathQuery); - } + onNavigateToPath(path); }} />