Skip to content

Commit

Permalink
2926: Fix rerendering loop in web
Browse files Browse the repository at this point in the history
  • Loading branch information
LeandraH committed Jan 8, 2025
1 parent 4c04e45 commit abe32c0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion web/src/hooks/useAllPossibleSearchResults.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { useMemo } from 'react'

import {
createCategoriesEndpoint,
createEventsEndpoint,
Expand Down Expand Up @@ -30,7 +32,10 @@ const useAllPossibleSearchResults = ({
const events = useLoadFromEndpoint(createEventsEndpoint, cmsApiBaseUrl, params)
const pois = useLoadFromEndpoint(createPOIsEndpoint, cmsApiBaseUrl, params)

const allPossibleResults = formatPossibleSearchResults(categories.data, events.data, pois.data)
const allPossibleResults = useMemo(
() => formatPossibleSearchResults(categories.data, events.data, pois.data),
[categories.data, events.data, pois.data],
)

return {
data: allPossibleResults,
Expand Down

0 comments on commit abe32c0

Please sign in to comment.