You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue with the infinite scroll functionality breaking when filters change in the self-hosted Dify version 1.0.0 is likely due to the useSWRInfinite hook's configuration. The getKey function, which generates the key for fetching data, depends on the tags, keywords, and includeAll parameters. When these parameters change, the hook should re-fetch the data with the new filters. However, the current setup might not automatically handle these changes to reset the pagination or re-fetch the data correctly.
To resolve this, ensure that the useSWRInfinite hook re-fetches data when the filter parameters change. You can achieve this by adding the filter parameters as dependencies in the useEffect hook that manages the scroll event. This ensures that the data is re-fetched when these parameters change:
useEffect(()=>{constonScroll=debounce(()=>{if(!loadingStateRef.current){const{ scrollTop, clientHeight }=containerRef.current!constanchorOffset=anchorRef.current!.offsetTopif(anchorOffset-scrollTop-clientHeight<100)setSize(size=>size+1)}},50)containerRef.current?.addEventListener('scroll',onScroll)return()=>containerRef.current?.removeEventListener('scroll',onScroll)},[tags,keywords,includeAll])// Add filter parameters as dependencies
This change updates the scroll event listener whenever the filter parameters change, prompting the useSWRInfinite hook to re-fetch data with the new filters [1].
Self Checks
Dify version
1.0.0
Cloud or Self Hosted
Self Hosted (Docker), Self Hosted (Source)
Steps to reproduce
✔️ Expected Behavior
Should load more items matching the filter
❌ Actual Behavior
Shows the same page being requested repeatedly
The text was updated successfully, but these errors were encountered: