WoL bugfix

This commit is contained in:
2025-06-25 23:08:52 -05:00
parent f7ed5c3971
commit 324b354ee2
2 changed files with 10 additions and 2 deletions

View File

@@ -20,7 +20,7 @@ function SettingsButton() {
const { mutateAsync } = useMutationAPI(); const { mutateAsync } = useMutationAPI();
const [categories, setCategories] = useState([{ value: 'All', label: 'All' }]); const [categories, setCategories] = useState([{ value: 'All', label: 'All' }]);
const [selectedClient] = useState<WolClient>(wolClientData?.[0]); const [selectedClient, setSelectedClient] = useState<WolClient>(wolClientData?.[0]);
const navigate = useNavigate(); const navigate = useNavigate();
const { const {
theme, theme,
@@ -62,7 +62,6 @@ function SettingsButton() {
setWolClients(wolClientData); setWolClients(wolClientData);
} }
}, [wolClientData, wolClientDataIsFetched]); }, [wolClientData, wolClientDataIsFetched]);
return ( return (
<Menu <Menu
classNames={menuClasses} classNames={menuClasses}
@@ -102,6 +101,7 @@ function SettingsButton() {
<WakeOnLan <WakeOnLan
wolClients={wolClients} wolClients={wolClients}
selectedClient={selectedClient} selectedClient={selectedClient}
setSelectedClient={setSelectedClient}
handleWakeRequest={handleWakeRequest} handleWakeRequest={handleWakeRequest}
/> />
<ThemingCard /> <ThemingCard />

View File

@@ -6,10 +6,12 @@ import type { WolClient } from 'types';
function WakeOnLan({ function WakeOnLan({
wolClients, wolClients,
selectedClient, selectedClient,
setSelectedClient,
handleWakeRequest, handleWakeRequest,
}: { }: {
wolClients: WolClient[]; wolClients: WolClient[];
selectedClient: WolClient | null; selectedClient: WolClient | null;
setSelectedClient: any;
handleWakeRequest: () => void; handleWakeRequest: () => void;
}) { }) {
return ( return (
@@ -37,6 +39,12 @@ function WakeOnLan({
labelProps={{ display: 'none' }} labelProps={{ display: 'none' }}
placeholder='Pick a host...' placeholder='Pick a host...'
defaultValue={wolClients?.[0]?.hostname} defaultValue={wolClients?.[0]?.hostname}
onChange={(_, option: any) => {
setSelectedClient({
hostname: option?.hostname,
macAddress: option?.macAddress,
});
}}
data={ data={
wolClients wolClients
?.map((wolClient: WolClient) => { ?.map((wolClient: WolClient) => {