FIX: The internal position on the topic timeline is a scroll position

... instead of a post index. This is so that updatePosition is called
when switching between the last two scroll positions.
This commit is contained in:
Daniel Waterworth 2019-11-07 09:46:00 +00:00
parent 00c406520e
commit 9c1a713c6e
1 changed files with 8 additions and 4 deletions

View File

@ -187,8 +187,11 @@ createWidget("timeline-scrollarea", {
}
if (this.state.position !== result.scrollPosition) {
this.state.position = result.scrollPosition;
this.sendWidgetAction("updatePosition", current);
this.sendWidgetAction(
"updatePosition",
result.current,
result.scrollPosition
);
}
return result;
@ -387,7 +390,7 @@ export default createWidget("topic-timeline", {
return { position: null, excerpt: null };
},
updatePosition(scrollPosition) {
updatePosition(postIdx, scrollPosition) {
if (!this.attrs.fullScreen) {
return;
}
@ -403,7 +406,8 @@ export default createWidget("topic-timeline", {
}
// we have an off by one, stream is zero based,
stream.excerpt(scrollPosition - 1).then(info => {
// postIdx is 1 based
stream.excerpt(postIdx - 1).then(info => {
if (info && this.state.position === scrollPosition) {
let excerpt = "";