oumoussa98 / vue3-infinite-loading

Infinite scroll component compatible with vuejs-3 and vitejs
https://vue3-infinite-loading.netlify.app/
191 stars 31 forks source link

Expose function to reset the state #59

Open toniengelhardt opened 1 year ago

toniengelhardt commented 1 year ago

Currently, once the complete event is fired, the list becomes stale and doesn't load more items, even if the list expands. The easy solution would be to either expose the state directly or a function setState(state: string) to call on the ref.

oumoussa98 commented 1 year ago

updating the state after calling the complete function wouldn't do noting as the observer gets disconnected you can use the identifier prop to get the desired behavior, whenever the identifier changes the observer gets started again and the infinite event would be triggered if the component is intersecting.

toniengelhardt commented 1 year ago

updating the state after calling the complete function wouldn't do noting as the observer gets disconnected you can use the identifier prop to get the desired behavior, whenever the identifier changes the observer gets started again and the infinite event would be triggered if the component is intersecting.

Ah great, but would the state not also be reset?