Select first result when selectedResult is not defined (#4770)

This commit is contained in:
Emilo2 2024-05-02 05:40:43 +03:00 committed by GitHub
parent 4c0d9d0a07
commit c43e7b4351
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -827,7 +827,7 @@ export const SceneSearchResults: React.FC<ISceneSearchResults> = ({
useEffect(() => {
// #3198 - if the selected result is no longer in the list, reset it
if (selectedResult && scenes?.length <= selectedResult) {
if (!selectedResult || scenes?.length <= selectedResult) {
if (!scenes) {
setSelectedResult(undefined);
} else if (scenes.length > 0 && scenes[0].resolved) {