Skip to content

Commit

Permalink
dont overwrite saved matches
Browse files Browse the repository at this point in the history
This is experimental, as re-reading logs causes rank data o get lost
  • Loading branch information
Manwe-777 committed May 4, 2024
1 parent 2978b4b commit 852aead
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/toolDb/setDbMatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@ export default async function setDbMatch(match: InternalMatch) {
// actionLog: match.actionLog,
};

// Put this match
putData<DbMatch>(`matches-${match.id}`, newDbMatch, true);

const remoteKey = getUserNamespacedKey(pubKey, `matches-${match.id}`);

if (!privateMode) {
// Send to explore and livefeed
window.toolDbWorker.postMessage({
type: "PUSH_DB_MATCH",
key: remoteKey,
match: newDbMatch,
});
}

// Create CRDT document with the new match added to it
if (!globalData.matchesIndex.includes(remoteKey)) {
// Put this match
putData<DbMatch>(`matches-${match.id}`, newDbMatch, true);

if (!privateMode) {
// Send to explore and livefeed
window.toolDbWorker.postMessage({
type: "PUSH_DB_MATCH",
key: remoteKey,
match: newDbMatch,
});
}

globalData.matchesIndex.push(remoteKey);
}

Expand Down

0 comments on commit 852aead

Please sign in to comment.