From b8e12cba35a89d932da056eb8ea9f6b02f8d7b09 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 11 Oct 2024 05:48:20 +0530 Subject: [PATCH] feat: use recordingUrl instead of currentUrl --- src/components/molecules/BrowserNavBar.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/molecules/BrowserNavBar.tsx b/src/components/molecules/BrowserNavBar.tsx index b35e4d7f..ad4e7d2d 100644 --- a/src/components/molecules/BrowserNavBar.tsx +++ b/src/components/molecules/BrowserNavBar.tsx @@ -12,6 +12,7 @@ import { UrlForm } from './UrlForm'; import { useCallback, useEffect, useState } from "react"; import { useSocketStore } from "../../context/socket"; import { getCurrentUrl } from "../../api/recording"; +import { useGlobalInfoStore } from '../../context/globalInfo'; const StyledNavBar = styled.div<{ browserWidth: number }>` display: flex; @@ -31,8 +32,7 @@ const BrowserNavBar: FC = ({ }) => { const { socket } = useSocketStore(); - - const [currentUrl, setCurrentUrl] = useState('https://'); + const { recordingUrl, setRecordingUrl } = useGlobalInfoStore(); const handleRefresh = useCallback((): void => { socket?.emit('input:refresh'); @@ -44,14 +44,13 @@ const BrowserNavBar: FC = ({ const handleCurrentUrlChange = useCallback((url: string) => { handleUrlChanged(url); - setCurrentUrl(url); - }, [handleUrlChanged, currentUrl]); + setRecordingUrl(url); + }, [handleUrlChanged, recordingUrl]); useEffect(() => { getCurrentUrl().then((response) => { if (response) { handleUrlChanged(response); - setCurrentUrl(response); } }).catch((error) => { console.log("Fetching current url failed"); @@ -72,6 +71,7 @@ const BrowserNavBar: FC = ({ const addAddress = (address: string) => { if (socket) { handleUrlChanged(address); + setRecordingUrl(address); handleGoTo(address); } }; @@ -111,7 +111,7 @@ const BrowserNavBar: FC = ({