Fix New Query view not opening at all

The Edit Query effect broke when view wasn't present somewhere
This commit is contained in:
Aurora Lahtela 2024-03-14 20:43:23 +02:00
parent 20b8ab9baa
commit a4cd8257e2

View File

@ -102,9 +102,9 @@ const QueryOptionsCard = () => {
}, [setFromTime, setFromDate, setToTime, setToDate]); }, [setFromTime, setFromDate, setToTime, setToDate]);
useEffect(() => { useEffect(() => {
if (!options || !result) return; if (!options?.view || !result?.view) return;
setSelectedServers(result.view.servers.map(server => options.view.servers.findIndex(s => s.serverUUID === server.serverUUID)).filter(i => i !== -1)) setSelectedServers(result.view.servers?.map(server => options.view.servers?.findIndex(s => s.serverUUID === server.serverUUID))?.filter(i => i !== -1) || [])
setFromDate(result.view.afterDate); setFromDate(result.view.afterDate);
setFromTime(result.view.afterTime); setFromTime(result.view.afterTime);