Prioritize d tag in video pointer resolution

When creating address pointers (`a` tags) for watch history, `resolveVideoPointer` was incorrectly prioritizing `videoRootId` over the actual NIP-33 `d` tag. If these values differed (common in newly published videos), the resulting pointer would reference a non-existent identifier, causing subsequent hydration to fail.

This change swaps the order to prioritize the `d` tag, ensuring watch history entries use the correct addressable identifier.
This commit is contained in:
google-labs-jules[bot] committed 2026-01-06 14:27:26 +00:00
1 parent 981c08f752
commit f9ce798332
1 file changed
+6 -6
+6 -6
View File
@@ -24,16 +24,16 @@ export function resolveVideoPointer({
const pointerCandidates = [];
const normalizedRelay = normalizeString(relay);
const rootId = normalizeString(videoRootId);
if (rootId && normalizedPubkey) {
const ptr = ["a", `${normalizedKind}:${normalizedPubkey}:${rootId}`];
const normalizedDTag = normalizeString(dTag);
if (normalizedDTag && normalizedPubkey) {
const ptr = ["a", `${normalizedKind}:${normalizedPubkey}:${normalizedDTag}`];
if (normalizedRelay) ptr.push(normalizedRelay);
pointerCandidates.push(ptr);
}
const normalizedDTag = normalizeString(dTag);
if (normalizedDTag && normalizedPubkey) {
const ptr = ["a", `${normalizedKind}:${normalizedPubkey}:${normalizedDTag}`];
const rootId = normalizeString(videoRootId);
if (rootId && normalizedPubkey) {
const ptr = ["a", `${normalizedKind}:${normalizedPubkey}:${rootId}`];
if (normalizedRelay) ptr.push(normalizedRelay);
pointerCandidates.push(ptr);
}