Fix feed post finder (scroll)
Deploy Livetrail / deploy (push) Successful in 18s

This commit is contained in:
2026-08-20 00:09:12 +02:00
parent 9242172a12
commit 73c5e45164
2 changed files with 29 additions and 25 deletions
+1 -2
View File
@@ -186,10 +186,9 @@ export default {
onMediaChange: async (oMedia) => {
this.hash.items = [this.project.codename, 'media', oMedia.id];
if(oMedia.set == 'post-medias') {
(await this.feed.goToPost('media', oMedia.id))?.panMapToMarker();
(await this.feed.findPost('media', oMedia.id))?.panMapToMarker();
if(!this.lightbox.hasMediaAfterCurrent()) {
await this.feed.getNextFeed();
await this.$nextTick();
this.lightbox.refreshAlbum();
}
}
+25 -20
View File
@@ -82,7 +82,7 @@ export default {
//Direct link post action
await(this.hash.items.length == 3
? this.findPost(this.hash.items[1], this.hash.items[2], pMapIsReady)
? this.findLinkedPost(this.hash.items[1], this.hash.items[2], pMapIsReady)
: this.getNextFeed()
);
@@ -91,41 +91,45 @@ export default {
getScrollElement() {
return this.$refs.feedSimpleBar?.scrollElement;
},
async findPost(sPostType, iPostId, pMapIsReady = Promise.resolve()) {
this.loadingPost = true;
let vPost = await this.goToPost(sPostType, iPostId);
async findLinkedPost(sPostType, iPostId, pMapIsReady) {
let vPost = await this.findPost(sPostType, iPostId, true);
if(vPost) {
await pMapIsReady;
await vPost.executeMainAction(0);
this.loadingPost = false;
return vPost;
}
else if(!this.outOfData) {
await this.getNextFeed();
await this.$nextTick();
return this.findPost(sPostType, iPostId, pMapIsReady);
}
else {
console.log('Missing element ID "'+iPostId+'" of type "'+sPostType+'"');
this.loadingPost = false;
return null;
}
else return null;
},
async goToPost(sPostType, iPostId) {
async findPost(sPostType, iPostId, bHidePosts=false) {
if(bHidePosts) this.loadingPost = true;
let avPosts = this.$refs?.posts?.filter((post) => {return post.postId == sPostType+'-'+iPostId;});
if(!avPosts || avPosts.length == 0) return null;
if(avPosts && avPosts.length > 0) {
let vPost = avPosts[0];
this.loadingPost = false;
//Force next update to have enough subsequent elements to position the post on top of the page
await this.getNextFeed();
let vPost = avPosts[0];
this.getScrollElement().scrollTop += Math.round(
//Position the post on top of the page
const $ScrollElement = this.getScrollElement();
$ScrollElement.scrollTop += Math.round(
vPost.$el.getBoundingClientRect().top
+ window.pageYOffset
- $ScrollElement.getBoundingClientRect().top
- parseFloat(getComputedStyle(this.$refs.feedSimpleBar.$el).paddingTop)
);
return vPost;
}
else if(!this.outOfData) {
await this.getNextFeed();
return this.findPost(sPostType, iPostId);
}
else {
this.loadingPost = false;
console.log('Missing element ID "'+iPostId+'" of type "'+sPostType+'"');
return null;
}
},
async getNextFeed() {
if(!this.project || this.outOfData || this.loadingFeed) return true;
@@ -148,6 +152,7 @@ export default {
this.loadingFeed = false;
this.firstChunk = false;
await this.$nextTick();
return true;
},
onFeedScroll(oEvent) {