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

hotfix: fix like marks on preview #74

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/components/Comment/Comment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ export default function Comment({ userData }) {
isError,
error,
isLoading,
} = useKyQuery(`products/${id}/comments`, undefined, { staleTime: 0 })
} = useKyQuery(`products/${id}/comments`, undefined, {
gcTime: 0,
staleTime: 0,
})

if (isError) return <div>{error}</div>
if (isLoading) return <div>loading</div>
Expand Down
5 changes: 4 additions & 1 deletion src/components/UserProfile/UserFollowButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ const useCheckFollow = (id) => {
data: following,
isLoading,
isError,
} = useKyQuery(`me/following/${id}`, ['me/following', id])
} = useKyQuery(`me/following/${id}`, ['me/following', id], {
gcTime: 300000,
staleTime: 300000,
})
seoulyego marked this conversation as resolved.
Show resolved Hide resolved

if (isLoading || isError) return undefined

Expand Down
1 change: 1 addition & 0 deletions src/hooks/useFetchContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const useFetchContent = (id) => {
const [currentPage, setCurrentPage] = useState(initialPageData)
const url = parseQueryParams(`members/${id}/products`, currentPage)
const { data: productList } = useKyQuery(url, undefined, {
gcTime: 0,
staleTime: 0,
enabled: !!id,
})
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useKyQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const useKyQuery = (uri, queryKey = [uri], options = null) => {
return useQuery({
queryKey,
queryFn: () => kyInstance.get(uri).json(),
gcTime: 300000,
staleTime: 300000,
gcTime: 0,
staleTime: 0,
retry: false,
...options,
})
Expand Down
5 changes: 4 additions & 1 deletion src/hooks/useNotificationFetch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ const useNotificationFetch = () => {
data: notifications,
isError,
isPending,
} = useKyQuery('notifications', undefined, { staleTime: 60000 })
} = useKyQuery('notifications', undefined, {
gcTime: 60000,
staleTime: 60000,
})

if (isPending || isError)
return {
Expand Down
1 change: 1 addition & 0 deletions src/hooks/useProductData.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function useProductData() {
})

const { isLoading, data, isError } = useKyQuery(uri, undefined, {
gcTime: 0,
staleTime: 0,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import CategorySelectList from './CategorySelectList'
import TagSelectForm from './TagSelectForm'

export default function CategorySubmitForm() {
const { data: categories } = useKyQuery('categories/hierarchy')
const { data: categories } = useKyQuery('categories/hierarchy', {
gcTime: 300000,
staleTime: 300000,
})

return (
<>
Expand Down
5 changes: 4 additions & 1 deletion src/pages/SubmitPage/components/InfoSubmit/InfoSubmit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import RatingInput from './RatingInput'
import NumberInputForm from './NumberInputForm'

export default function InfoSubmitForm() {
const { data: currencies, isLoading } = useKyQuery('currencies')
const { data: currencies, isLoading } = useKyQuery('currencies', undefined, {
gcTime: 300000,
staleTime: 300000,
})

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ import useKyQuery from '@hooks/useKyQuery'

const useDefaultCurrency = (setFormContents) => {
const country = useFormStore((state) => state.country)
const { data, isLoading } = useKyQuery(`currencies?country_id=${country.id}`)
const { data, isLoading } = useKyQuery(
`currencies?country_id=${country.id}`,
undefined,
{
gcTime: 300000,
staleTime: 300000,
}
)
seoulyego marked this conversation as resolved.
Show resolved Hide resolved

useEffect(() => {
if (!isLoading) setFormContents({ currencyId: data.data[0].id })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import RegionSelectList from './RegionSelectList'
import AddressInputForm from './AddressInputForm'

export default function RegionSubmitPage() {
const { data: regions } = useKyQuery('regions/hierarchy')
const { data: regions } = useKyQuery('regions/hierarchy', undefined, {
gcTime: 300000,
staleTime: 300000,
})
seoulyego marked this conversation as resolved.
Show resolved Hide resolved

return (
<>
Expand Down
5 changes: 4 additions & 1 deletion src/pages/UserPage/FollowingList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ function FollowingList() {
const { data: followingList, isLoading } = useKyQuery(
'me/following',
undefined,
{ staleTime: 0 }
{
gcTime: 0,
staleTime: 0,
}
seoulyego marked this conversation as resolved.
Show resolved Hide resolved
)

if (isLoading) return null
Expand Down
1 change: 1 addition & 0 deletions src/pages/UserPage/ReviewList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function ReviewList({ selectedMenu }) {
const [currentPage, setCurrentPage] = useState(initialPageData)
const url = parseQueryParams(`${selectedMenu}`, currentPage)
const { data: productList } = useKyQuery(url, undefined, {
gcTime: 0,
staleTime: 0,
})

Expand Down
Loading