nicolium: attempt at fixing duplicated statuses in timeline

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
nicole mikołajczyk
2026-03-07 09:55:26 +01:00
parent a6dff62034
commit 405e99ed08

View File

@ -182,7 +182,10 @@ const useTimelinesStore = create<State>()(
const timeline = state.timelines[timelineId];
if (!timeline) return;
if (timeline.entries.some((entry) => entry.type === 'status' && entry.id === status.id))
if (
timeline.entries.some((entry) => entry.type === 'status' && entry.id === status.id) ||
timeline.queuedEntries.some((s) => s.id === status.id)
)
return;
timeline.queuedEntries.unshift(status);
@ -303,6 +306,13 @@ const useTimelinesStore = create<State>()(
(e) => e.type === 'pending-status' && e.id === idempotencyKey,
);
if (idx !== -1) {
if (
timeline.entries.some((entry) => entry.type === 'status' && entry.id === newId) ||
timeline.queuedEntries.some((s) => s.id === newId)
) {
timeline.entries.splice(idx, 1);
return;
}
timeline.entries[idx] = {
type: 'status',
id: newId,