Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(searchResultsByProperty): No results found message when no results for any property #2159

Merged
merged 4 commits into from
Aug 2, 2023

Conversation

KaylaBrady
Copy link
Contributor

@KaylaBrady KaylaBrady commented Jul 28, 2023

@github-actions
Copy link

Coverage of commit b00ba2c

Summary coverage rate:
  lines......: 94.8% (2914 of 3074 lines)
  functions..: 74.7% (1213 of 1624 functions)
  branches...: no data found

Files changed coverage rate: n/a

Download coverage report

@github-actions
Copy link

Coverage of commit 9f3ddbf

Summary coverage rate:
  lines......: 94.8% (2914 of 3074 lines)
  functions..: 74.7% (1213 of 1624 functions)
  branches...: no data found

Files changed coverage rate: n/a

Download coverage report

@github-actions
Copy link

Coverage of commit 6023cc4

Summary coverage rate:
  lines......: 94.8% (2914 of 3074 lines)
  functions..: 74.7% (1213 of 1624 functions)
  branches...: no data found

Files changed coverage rate: n/a

Download coverage report

@KaylaBrady KaylaBrady temporarily deployed to dev-blue July 31, 2023 14:20 — with GitHub Actions Inactive
@github-actions
Copy link

Coverage of commit 65cce65

Summary coverage rate:
  lines......: 94.8% (2914 of 3074 lines)
  functions..: 74.7% (1213 of 1624 functions)
  branches...: no data found

Files changed coverage rate: n/a

Download coverage report

@KaylaBrady KaylaBrady marked this pull request as ready for review July 31, 2023 15:07
@KaylaBrady KaylaBrady requested a review from a team July 31, 2023 15:07
Comment on lines +29 to +33
const useSearchResultsByProperty = (
socket: Socket | undefined,
text: string,
properties: PropertyLimits
): SearchResultsByProperty => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: do you think it'd be useful to rewrite useAutocompleteResults using this function? Seems like we ended up doing the same thing heh!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh shoot, sorry I didn't realize we were overlapping there! My preference would probably be that we keep these independent for now to prevent blocking each other with merges, but maybe do a cleanup ticket to consolidate if it ends up seeming useful?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries!
and a cleanup ticket afterward sounds good to me 👍🏻

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One other thing to consider is that the functionality for location autocomplete vs. results will actually be different (though that can probably be handled by an extra argument to the hook specifying which one you want).

)}
</section>
)
}

const ShowMore = ({ property }: { property: SearchProperty }) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: thanks for pulling this out into a separate component, I should have done this originally in my PR.

Comment on lines +22 to +27
export type SearchResultsByProperty = {
vehicle: VehicleResultType
operator: VehicleResultType
run: VehicleResultType
location: LocationResultsType
}
Copy link
Member

@firestack firestack Aug 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question(non-blocking): Would making this generic make it easier to share this code between autocomplete and search results without making the code too complex?

maybe something along the lines of this?

Suggested change
export type SearchResultsByProperty = {
vehicle: VehicleResultType
operator: VehicleResultType
run: VehicleResultType
location: LocationResultsType
}
export type SearchPropertyResults<TVehicleResult, TLocationResult> = {
vehicle: TVehicleResult
operator: TVehicleResult
run: TVehicleResult
location: TLocationResult
}
export type SearchResultsByProperty = SearchPropertyResults<VehicleResultType, LocationResultsType>
export type AutocompleteResultsByProperty = SearchPropertyResults<VehicleResultType, LocationSuggestionsResultsType>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh I like that idea! I wonder if it might help to make a generic SearchPropertyResult type too so they can share loading / ok / null states? I'm not sure that autocomplete will need to keep the shape of LimitedSearchResults though...

I think I'll hold off on adding generics here for now since I'm not quite seeing the full path to code sharing with autocomplete, but I support adding them as part of that work!

type SearchPropertyResult<T> = Ok<LimitedSearchResults<T>> | Loading | null

export type SearchResultsByProperty<TVehicleResult, TLocationResult> = {
  vehicle: SearchPropertyResult<TVehicleResult>
  operator: SearchPropertyResult<TVehicleResult>
  run: SearchPropertyResult<TVehicleResult>
  location: SearchPropertyResult<TLocationResult>
}

@KaylaBrady KaylaBrady merged commit 5dcad71 into master Aug 2, 2023
7 checks passed
@KaylaBrady KaylaBrady deleted the kb-no-search-results-msg branch August 2, 2023 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants