fix: fix a bug with whereResultsStick

This commit is contained in:
jinhojang6 2023-09-07 00:20:30 +09:00
parent 4ec9d0ed84
commit 91a7b35682
1 changed files with 5 additions and 2 deletions

View File

@ -123,16 +123,19 @@ const SearchBox = (props: SearchBoxProps) => {
}, [focused, queryInput])
useEffect(() => {
if (filtersRef.current) {
if (filtersRef.current && hydrated && queryInput) {
const filtersB = filtersRef.current.getBoundingClientRect().bottom
const parentT =
filtersRef.current.parentElement?.getBoundingClientRect().top || 0
const whereResultsStick =
-1 * (filtersB - parentT - uiConfigs.navbarRenderedHeight + 2)
setWhereResultsStick(whereResultsStick)
setDetailsTop(filtersB + whereResultsStick)
}
}, [])
}, [filtersRef, hydrated, queryInput])
useEffect(() => {
const onScroll = () => {