Skip to content

Calling $state.complete at top direction scroll. #246

Open
@gigosa

Description

@gigosa

Thanks to your great work.

I'm using top direction scroll. When I call $state.complete() at the top of the list, scroll position will not come back to the previous place.
The following is reproduction link.
https://jsfiddle.net/n4p7ovm6/

I have a question that, does this plugin assumes to call $state.complete() only when the response data length of the API is 0?

I will also describe how I solved it.

this.$nextTick(() => {
  const target = document.documentElement;
  target.scrollTop = target.scrollHeight - target._infiniteScrollHeight + target.scrollTop;
});
$state.complete();

If this plugin assumes to call $state.complete() at any other times, I think it can be fixed by adding scrollBarStorage.restore(this.scrollParent); before this.$forceUpdate(). IMHO.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions