Skip to content

Commit

Permalink
2926: Show search bar when loading results first
Browse files Browse the repository at this point in the history
  • Loading branch information
LeandraH committed Jan 7, 2025
1 parent 17cbbd2 commit 4c04e45
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions native/src/routes/SearchModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { parseHTML, SEARCH_FINISHED_SIGNAL_NAME, SEARCH_ROUTE, SearchResult, use

import FeedbackContainer from '../components/FeedbackContainer'
import List from '../components/List'
import Loader from '../components/LoadingSpinner'
import SearchHeader from '../components/SearchHeader'
import SearchListItem from '../components/SearchListItem'
import useResourceCache from '../hooks/useResourceCache'
Expand Down Expand Up @@ -53,10 +54,6 @@ const SearchModal = ({

const searchResults = contentLanguageResults?.length === 0 ? fallbackLanguageResults : contentLanguageResults

if (!searchResults) {
return null
}

const onClose = (): void => {
sendTrackingSignal({
signal: {
Expand All @@ -68,6 +65,15 @@ const SearchModal = ({
closeModal(query)
}

if (!searchResults) {
return (
<Wrapper {...testID('Search-Page')}>
<SearchHeader query={query} closeSearchBar={onClose} onSearchChanged={setQuery} />
{!!query.length && <Loader />}
</Wrapper>
)
}

const renderItem = ({ item }: { item: SearchResult }) => (
<SearchListItem
key={item.path}
Expand Down

0 comments on commit 4c04e45

Please sign in to comment.