╭ changed ─────────╮ │src/event/User.zig│ ╰──────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ │48 │ │49 // if this event_id already maps to a user with a different name, │ │50 // drop the stale name->id entry first │ │51 - if (try event_id_to_user.getCursor(user_key)) |existing_cursor| { │ │51 + const existing_cursor_maybe = try event_id_to_user.getCursor(user_key); │ │52 + if (existing_cursor_maybe) |existing_cursor| { │ │53 const existing_user = try DB.HashMap(.read_only).init(existing_cursor); │ │54 const existing_event = try evt.read(@This(), DB, hash_kind, arena, existing_user);│ │55 if (!std.mem.eql(u8, existing_event.name, event.name)) { │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │62 try evt.upsert(@This(), DB, hash_kind, user, event); │ │63 │ │64 try name_to_user_id.put(hash.hashInt(hash_kind, event.name), .{ .bytes = event_id }); │ │65 + │ │66 + // first time we've seen this user: append its id to the ordered list │ │67 + // the users view paginates through (a delete leaves a tombstone here). │ │68 + if (existing_cursor_maybe == null) { │ │69 + const user_list_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, "user-list"));│ │70 + const user_list = try DB.ArrayList(.read_write).init(user_list_cursor); │ │71 + try user_list.append(.{ .bytes = event_id }); │ │72 + } │ │73 } else { │ │74 // read the user's name so we can drop its name->id index entry │ │75 if (try event_id_to_user.getCursor(user_key)) |existing_cursor| { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯