fix off-by-one error in visible messages for current channel
This commit is contained in:
@@ -277,7 +277,8 @@ export const subscribe_to_channel = spacetimedb.reducer(
|
||||
(ctx, { channelId }) => {
|
||||
const hwm = ctx.db.channel_high_water_mark.channel_id.find(channelId);
|
||||
const currentMax = hwm ? hwm.last_seq_id : 0n;
|
||||
const earliest = currentMax > 100n ? currentMax - 100n : 0n;
|
||||
// Sync exactly 100 messages (e.g. if max is 100, we want 1-100 inclusive, so earliest is 1)
|
||||
const earliest = currentMax > 99n ? currentMax - 99n : 1n;
|
||||
|
||||
const existing = ctx.db.channel_subscription.identity.find(ctx.sender);
|
||||
if (existing) {
|
||||
|
||||
Reference in New Issue
Block a user