v3: fixes to database schema and user registration
This commit is contained in:
@@ -882,7 +882,9 @@ function UpvotedDumpList(
|
||||
// be called in the same effect body — guaranteeing a single render where the
|
||||
// dump is always in visibleDumps (with or without fading class). This prevents
|
||||
// the DOM node from being unmounted/remounted, which would break CSS transitions.
|
||||
const [votedIds, setVotedIds] = useState(() => new Set(dumps.map((d) => d.id)));
|
||||
const [votedIds, setVotedIds] = useState(() =>
|
||||
new Set(dumps.map((d) => d.id))
|
||||
);
|
||||
const prevMyVotesRef = useRef<Set<string> | null>(null);
|
||||
|
||||
// Own profile: sync votedIds with myVotes; start/cancel fading in same batch.
|
||||
@@ -895,8 +897,8 @@ function UpvotedDumpList(
|
||||
}
|
||||
const prev = prevMyVotesRef.current;
|
||||
setVotedIds(new Set(wsMyVotes));
|
||||
for (const id of prev) { if (!wsMyVotes.has(id)) startFading(id); }
|
||||
for (const id of wsMyVotes) { if (!prev.has(id)) cancelFading(id); }
|
||||
for (const id of prev) if (!wsMyVotes.has(id)) startFading(id);
|
||||
for (const id of wsMyVotes) if (!prev.has(id)) cancelFading(id);
|
||||
prevMyVotesRef.current = new Set(wsMyVotes);
|
||||
}, [wsMyVotes, isOwnProfile, profileUserId, startFading, cancelFading]);
|
||||
|
||||
@@ -906,7 +908,11 @@ function UpvotedDumpList(
|
||||
const { dumpId, voterId, action } = lastVoteEvent;
|
||||
if (voterId !== profileUserId) return;
|
||||
if (action === "remove") {
|
||||
setVotedIds((prev) => { const n = new Set(prev); n.delete(dumpId); return n; });
|
||||
setVotedIds((prev) => {
|
||||
const n = new Set(prev);
|
||||
n.delete(dumpId);
|
||||
return n;
|
||||
});
|
||||
startFading(dumpId);
|
||||
} else {
|
||||
setVotedIds((prev) => new Set([...prev, dumpId]));
|
||||
@@ -914,7 +920,9 @@ function UpvotedDumpList(
|
||||
}
|
||||
}, [lastVoteEvent, profileUserId, isOwnProfile, startFading, cancelFading]);
|
||||
|
||||
const visibleDumps = dumps.filter((d) => votedIds.has(d.id) || d.id in fading);
|
||||
const visibleDumps = dumps.filter((d) =>
|
||||
votedIds.has(d.id) || d.id in fading
|
||||
);
|
||||
|
||||
return (
|
||||
<section className="profile-section">
|
||||
|
||||
Reference in New Issue
Block a user