diff --git a/frontend/src/stores/posts.js b/frontend/src/stores/posts.js index f02e980..ac45a6e 100644 --- a/frontend/src/stores/posts.js +++ b/frontend/src/stores/posts.js @@ -59,14 +59,37 @@ export const usePostsStore = defineStore('posts', () => { return await api.get(`/api/posts/${id}`) } + // Filter overlay for the around/older/newer (in-context anchored) + // path. Keep this distinct from `filters.value` (the down-only feed) + // so a normal-feed filter change doesn't leak into an active anchored + // view (or vice versa). Caller of loadAround passes the snapshot; the + // subsequent loadOlder/loadNewer use it verbatim. + function _aroundParams(extra) { + const p = { ...extra } + if (filters.value.artist_id != null) p.artist_id = filters.value.artist_id + if (filters.value.platform) p.platform = filters.value.platform + return p + } + // Load a window centered on `postId`: newer posts above, the post, older // posts below. Sets both directional cursors for subsequent scrolling. - async function loadAround(postId) { + // Accepts the same filter shape as loadInitial so the anchored view + // stays artist/platform-scoped (operator-flagged 2026-06-01: clicking a + // post title from the modal's Provenance card opens the post in the + // posts feed; without this the older/newer scroll loaded unfiltered + // global posts instead of staying in the artist's stream). + async function loadAround(postId, newFilters) { + filters.value = { + artist_id: newFilters?.artist_id ?? null, + platform: newFilters?.platform ?? null, + } loading.value = true error.value = null anchorId.value = null try { - const body = await api.get('/api/posts', { params: { around: postId } }) + const body = await api.get('/api/posts', { + params: _aroundParams({ around: postId }), + }) items.value = body.items cursorOlder.value = body.cursor_older cursorNewer.value = body.cursor_newer @@ -85,7 +108,9 @@ export const usePostsStore = defineStore('posts', () => { loading.value = true try { const body = await api.get('/api/posts', { - params: { cursor: cursorOlder.value, direction: 'older' }, + params: _aroundParams({ + cursor: cursorOlder.value, direction: 'older', + }), }) items.value.push(...body.items) cursorOlder.value = body.next_cursor @@ -102,7 +127,9 @@ export const usePostsStore = defineStore('posts', () => { loading.value = true try { const body = await api.get('/api/posts', { - params: { cursor: cursorNewer.value, direction: 'newer' }, + params: _aroundParams({ + cursor: cursorNewer.value, direction: 'newer', + }), }) items.value.unshift(...body.items) cursorNewer.value = body.next_cursor diff --git a/frontend/src/views/PostsView.vue b/frontend/src/views/PostsView.vue index a08a09d..0485a5a 100644 --- a/frontend/src/views/PostsView.vue +++ b/frontend/src/views/PostsView.vue @@ -161,7 +161,15 @@ function setupAroundObservers() { } async function loadAroundAndAnchor() { teardownFeed() - await store.loadAround(postIdFilter.value) + // Pass artist_id + platform through so the anchored view stays + // scoped — the older/newer infinite scrolls then read these filters + // back via the store's _aroundParams (operator-flagged 2026-06-01: + // post-title click from the modal landed scoped but the scroll then + // pulled unfiltered global posts). + await store.loadAround(postIdFilter.value, { + artist_id: artistFilter.value, + platform: platformFilter.value, + }) await nextTick() const el = document.getElementById(`fc-post-${store.anchorId}`) if (el) el.scrollIntoView({ block: 'center' })