Skip to content

Commit 6456a4f

Browse files
authored
1 parent eacc4ed commit 6456a4f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

assets/javascripts/initializers/related-topics.gjs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,16 @@ export default {
4747
(Superclass) =>
4848
class extends Superclass {
4949
@tracked related_topics;
50+
relatedTopicsCache = [];
5051

5152
@cached
5253
get relatedTopics() {
53-
return this.related_topics?.map((topic) =>
54+
// Used to keep related topics when a user scrolls up from the
55+
// bottom of the topic and then scrolls back down
56+
if (this.related_topics) {
57+
this.relatedTopicsCache = this.related_topics;
58+
}
59+
return this.relatedTopicsCache?.map((topic) =>
5460
this.store.createRecord("topic", topic)
5561
);
5662
}

0 commit comments

Comments
 (0)