Skip to content

Commit

Permalink
fix issue tomsouthall#7 - Issue while having multiple Turnstone compo…
Browse files Browse the repository at this point in the history
…nents on same page
  • Loading branch information
webcodavic committed Mar 14, 2024
1 parent 9282c4b commit 6711b9c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/components/hooks/useData.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,16 @@ export const fetcher = (query, listbox, defaultListbox, minQueryLength, maxItems
})
}

const useData = (query, isImmutable, listbox, defaultListbox, minQueryLength, maxItems) => {
const useData = (query, isImmutable, listbox, defaultListbox, minQueryLength, maxItems, dispatch) => {

// See: https://github.com/vercel/swr/discussions/1810
const dummyArgToEnsureCachingOfZeroLengthStrings = 'X'

const swrObj = useSWR(
[
query.toLowerCase(),
dummyArgToEnsureCachingOfZeroLengthStrings
dummyArgToEnsureCachingOfZeroLengthStrings,
dispatch
],
(query) => fetcher(query, listbox, defaultListbox, minQueryLength, maxItems),
swrOptions(isImmutable)
Expand Down

0 comments on commit 6711b9c

Please sign in to comment.