Skip to content

Commit

Permalink
Fix navigating from adapter card to repo checker
Browse files Browse the repository at this point in the history
Fixes #86
  • Loading branch information
UncleSamSwiss committed Jan 17, 2025
1 parent 6900516 commit f1deec2
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions express/frontend/src/tools/AdapterCheck.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
import { OverridableComponent } from "@mui/material/OverridableComponent";
import { useEffect, useState } from "react";
import Chart from "react-google-charts";
import { useLocation } from "react-router-dom";
import { useSearchParams } from "react-router-dom";
import { useUserToken } from "../contexts/UserContext";
import { checkAdapter, CheckResult, getMyAdapterRepos } from "../lib/ioBroker";

Expand Down Expand Up @@ -92,7 +92,7 @@ export interface AdapterCheckLocationState {

export function AdapterCheck() {
const token = useUserToken();
let location = useLocation();
const [searchParams] = useSearchParams();
const [repoNames, setRepoNames] = useState<string[]>([]);
const [repoName, setRepoName] = useState("");
const [busy, setBusy] = useState(false);
Expand All @@ -105,14 +105,12 @@ export function AdapterCheck() {
loadData().catch(console.error);
}, [token]);

const incomingState = location.state as
| AdapterCheckLocationState
| undefined;
const repo = searchParams.get("repo");
useEffect(() => {
if (incomingState?.repoFullName) {
setRepoName(incomingState.repoFullName);
if (repo) {
setRepoName(repo);
}
}, [incomingState]);
}, [repo]);

const handleStartClick = async () => {
setMessages([]);
Expand Down

0 comments on commit f1deec2

Please sign in to comment.