Skip to content

fix(SingleContent): ensure correct content rendering on slug change and add navigation tests - #1968

Open
MrDirkelz wants to merge 4 commits into
mainfrom
1961-app-previous-posts-content-and-video-source-are-reused-when-navigating-to-another-post
Open

fix(SingleContent): ensure correct content rendering on slug change and add navigation tests#1968
MrDirkelz wants to merge 4 commits into
mainfrom
1961-app-previous-posts-content-and-video-source-are-reused-when-navigating-to-another-post

Conversation

@MrDirkelz

Copy link
Copy Markdown
Collaborator

No description provided.

@MrDirkelz MrDirkelz self-assigned this Aug 31, 2026
@MrDirkelz
MrDirkelz force-pushed the 1961-app-previous-posts-content-and-video-source-are-reused-when-navigating-to-another-post branch from ac3a566 to 52b145b Compare August 31, 2026 12:20

@johan-bell johan-bell left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid fix — scoping every read of the slug query's window to the current slug closes the stale-render path cleanly, and the added tests fail on main. Non-blocking notes: the comments at SingleContent.vue:199/288 still describe the old contentArr semantics and read stale next to contentForSlug; keying the player on content._id also rebuilds it on an in-place translation switch (no carried-over position) — flagging in case that UX wasn't intended; and with the slug scoping in place, cache:true on the slug query is effectively write-only for the non-SSG SPA, so it could be scoped to isSSG.

@ivanslabbert ivanslabbert left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to find the issue at source (in how HybridQuery is used). It seems as if some type of response caching is enabled, causing the query to give old values before mutating to the correct value.

@MrDirkelz
MrDirkelz force-pushed the 1961-app-previous-posts-content-and-video-source-are-reused-when-navigating-to-another-post branch from 6493494 to d80dc3f Compare September 1, 2026 07:41
@MrDirkelz

Copy link
Copy Markdown
Collaborator Author

You were right, it's fixed at source now.

Two things were keeping the previous post on screen. The response cache — its key is a structural fingerprint that excludes values, so with a per-slug cacheId only on the SSG build, every article shared one entry. And _rebuild, which deliberately keeps output across a rebuild; that one has nothing to do with caching, which is why scoping the cache alone still left the in-app navigation flash.

The keep-across-rebuild can't be inferred from the selector — a feed switching category wants the old tiles held as a placeholder, a slug lookup switching article doesn't, and the two look identical from inside HybridQuery. So it's a declared option now: keepPreviousResult, default true so no existing consumer changes. Both queries here set it false, plus cache: isSSG.

That let contentForSlug and the availableTranslations filter come back out. Only the VideoPlayer :key stays — the translation switch swaps content directly without rebuilding a query.

edee0ec3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

APP: Previous post's content and video source are reused when navigating to another post

3 participants