Fix watch history hydration by preserving relay hints

Ensures that the relay hint is preserved when recording a video view, allowing the hydration logic to fetch the video details from the correct relay.
- Updated `resolveVideoPointer` in `js/utils/videoPointer.js` to accept a `relay` argument.
- Updated `playVideoByEventId`, `checkUrlParams`, and `deriveVideoPointerInfo` in `js/app.js` to pass the relay hint when resolving the video pointer.
This commit is contained in:
google-labs-jules[bot] committed 2026-01-06 14:12:59 +00:00
1 parent a613d2d99f
commit e6a6ea6f78
2 files changed
+19 -8

No files matched your search

+11 -6
View File
@@ -16,28 +16,33 @@ export function resolveVideoPointer({
videoRootId,
dTag,
fallbackEventId,
relay,
} = {}) {
const normalizedPubkey = normalizeString(pubkey).toLowerCase();
const normalizedKind =
typeof kind === "number" && Number.isFinite(kind) ? kind : DEFAULT_VIDEO_KIND;
const pointerCandidates = [];
const normalizedRelay = normalizeString(relay);
const rootId = normalizeString(videoRootId);
if (rootId && normalizedPubkey) {
pointerCandidates.push(["a", `${normalizedKind}:${normalizedPubkey}:${rootId}`]);
const ptr = ["a", `${normalizedKind}:${normalizedPubkey}:${rootId}`];
if (normalizedRelay) ptr.push(normalizedRelay);
pointerCandidates.push(ptr);
}
const normalizedDTag = normalizeString(dTag);
if (normalizedDTag && normalizedPubkey) {
pointerCandidates.push([
"a",
`${normalizedKind}:${normalizedPubkey}:${normalizedDTag}`,
]);
const ptr = ["a", `${normalizedKind}:${normalizedPubkey}:${normalizedDTag}`];
if (normalizedRelay) ptr.push(normalizedRelay);
pointerCandidates.push(ptr);
}
const fallbackId = normalizeString(fallbackEventId);
if (fallbackId) {
pointerCandidates.push(["e", fallbackId]);
const ptr = ["e", fallbackId];
if (normalizedRelay) ptr.push(normalizedRelay);
pointerCandidates.push(ptr);
}
for (const pointer of pointerCandidates) {