fix(schedule): deduplicate @for track key for split event segments

Split projections (RepeatProjectionSplit, SplitTaskContinued, and related
types) share the underlying task/repeat-cfg id across their visual segments,
producing NG0955 duplicate-key warnings in the week-view grid. Combine id,
plannedForDay, and startHours so each segment has a unique track key and
Angular can reconcile views cleanly.
This commit is contained in:
Johannes Millan 2026-04-21 16:55:12 +02:00
parent 28daf519fb
commit 960d269ca2
2 changed files with 9 additions and 2 deletions

View file

@ -93,7 +93,7 @@
}
<!-- Events -->
@for (ev of safeEvents(); track ev.id) {
@for (ev of safeEvents(); track trackEventKey(ev)) {
@if (isDraggableSE(ev)) {
<schedule-event
class="draggable"
@ -127,7 +127,7 @@
<mat-icon>hourglass_disabled</mat-icon>
{{ beyondBudgetDay.length }}
</div>
@for (ev of beyondBudgetDay; track ev.id) {
@for (ev of beyondBudgetDay; track trackEventKey(ev)) {
@if (isDraggableSE(ev)) {
<schedule-event
[event]="ev"

View file

@ -115,6 +115,13 @@ export class ScheduleWeekComponent implements OnInit, AfterViewInit, OnDestroy {
safeEvents = computed(() => this.events() || []);
safeBeyondBudget = computed(() => this.beyondBudget() || []);
// Split projections (RepeatProjectionSplit, SplitTaskContinued, …) share the
// task/repeat-cfg id across segments. Combine day + start hour so each visual
// segment has a unique @for track key and Angular can reconcile them.
trackEventKey(ev: ScheduleEvent): string {
return `${ev.id}_${ev.plannedForDay ?? ''}_${ev.startHours}`;
}
newTaskPlaceholder = signal<{
style: string;
time: string;