Fix: premium events were all collapsing into one row via fingerprint dedup

Adam reported the "All" filter in the template browser was empty. The
root cause: when buildRowsFromEvents synthesises a stub payload for a
still-locked premium row (we can't see the encrypted content), the
stub has no layers / slots / canvas data — so designFingerprint
returns essentially the same string for every premium row of the
same template mode. dedupByFingerprint then collapses them all into
a single row whose title happens to come from the earliest createdAt
event. With a feed full of premium designs and no plain ones, the
"All" view looked nearly empty.

Fix: designFingerprint short-circuits and returns '' (treated by
dedupByFingerprint as "skip dedup, always keep this row") for any
payload that has `premium: true` AND no content-bearing fields
(layers / coverTemplate / discTemplate / customArt / etc). That
matches exactly the stub shape produced by
_stubPayloadFromPremiumEvent — once the user unlocks and the cached
decrypted payload replaces the stub, the row has its real fields
back and normal content-based dedup resumes.

Tested via CDP:
  - 5 premium events from different creators with different d-tags
    and titles → all 5 rows survive the rerender → all 5 cards
    visible. Previously this would have been 1 card.
  - The earlier mixed test (1 plain + 1 premium + 1 legacy) keeps
    the same 2-card result (plain + legacy DO have matching
    fingerprints because their plaintext is identical) — exactly
    what dedup is supposed to do for non-premium events.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
This commit is contained in:
thePR0M3TH3ANandClaude Opus 4.7 committed 2026-05-28 22:12:58 -04:00
1 parent c87ec907ef
commit 95a7130255
1 file changed
+12
+12
View File
@@ -20240,6 +20240,18 @@
// Two events with the same fingerprint represent the exact same design.
function designFingerprint(payload) {
if (!payload) return '';
// Premium events publish an encrypted envelope, so the fingerprint
// function can't see the real design — every still-locked stub of
// the same templateMode would otherwise hash to the same value and
// dedupByFingerprint would collapse them all into one feed row.
// Treat each premium row as unique (empty fingerprint = "skip dedup"
// in dedupByFingerprint). Once unlocked, payload becomes the real
// decrypted JSON and dedup falls through normally.
if (payload.premium === true && !payload.layers && !payload.slide && !payload.customArt
&& !payload.coverTemplate && !payload.discTemplate && !payload.jewelTemplate
&& !payload.discDesign && !payload.deck && !payload.pixelArt) {
return '';
}
const mode = normalizeTemplateMode(payload);
const j = (v) => JSON.stringify(v ?? null);
const fields = [mode];