fix: fix a bug with whereResultsStick
This commit is contained in:
parent
4ec9d0ed84
commit
91a7b35682
|
@ -123,16 +123,19 @@ const SearchBox = (props: SearchBoxProps) => {
|
||||||
}, [focused, queryInput])
|
}, [focused, queryInput])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (filtersRef.current) {
|
if (filtersRef.current && hydrated && queryInput) {
|
||||||
const filtersB = filtersRef.current.getBoundingClientRect().bottom
|
const filtersB = filtersRef.current.getBoundingClientRect().bottom
|
||||||
|
|
||||||
const parentT =
|
const parentT =
|
||||||
filtersRef.current.parentElement?.getBoundingClientRect().top || 0
|
filtersRef.current.parentElement?.getBoundingClientRect().top || 0
|
||||||
|
|
||||||
const whereResultsStick =
|
const whereResultsStick =
|
||||||
-1 * (filtersB - parentT - uiConfigs.navbarRenderedHeight + 2)
|
-1 * (filtersB - parentT - uiConfigs.navbarRenderedHeight + 2)
|
||||||
|
|
||||||
setWhereResultsStick(whereResultsStick)
|
setWhereResultsStick(whereResultsStick)
|
||||||
setDetailsTop(filtersB + whereResultsStick)
|
setDetailsTop(filtersB + whereResultsStick)
|
||||||
}
|
}
|
||||||
}, [])
|
}, [filtersRef, hydrated, queryInput])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const onScroll = () => {
|
const onScroll = () => {
|
||||||
|
|
Loading…
Reference in New Issue