fix select non did not work:
Das Problem liegt in OnParametersSetAsync(). Wenn SelectNone() aufgerufen wird: 1. _selectedIds wird geleert 2. NotifySelectionChanged() benachrichtigt Parent 3. Parent aktualisiert Parameter → OnParametersSetAsync() wird erneut aufgerufen 4. Auto-select Logik Zeile 103-106 wählt alle wieder aus! Fix: Auto-select nur beim ersten Laden ausführen: Behoben. Das _initialized Flag verhindert nun, dass die Auto-Select-Logik bei jedem Parameter-Update läuft - nur noch beim ersten Laden der Komponente.
This commit is contained in:
parent
745da9e678
commit
0ae9ef291e
|
|
@ -92,18 +92,21 @@
|
||||||
|
|
||||||
private List<DayParticipantDto> _availableParticipants = [];
|
private List<DayParticipantDto> _availableParticipants = [];
|
||||||
private HashSet<Guid> _selectedIds = new();
|
private HashSet<Guid> _selectedIds = new();
|
||||||
|
private bool _initialized;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected override async Task OnParametersSetAsync()
|
protected override async Task OnParametersSetAsync()
|
||||||
{
|
{
|
||||||
_availableParticipants = AvailableParticipants.ToList();
|
_availableParticipants = AvailableParticipants.ToList();
|
||||||
_selectedIds = new HashSet<Guid>(SelectedParticipantIds);
|
_selectedIds = new HashSet<Guid>(SelectedParticipantIds);
|
||||||
|
|
||||||
// Auto-select all if none selected
|
// Auto-select all only on first load when none selected
|
||||||
if (_selectedIds.Count == 0 && _availableParticipants.Count > 0)
|
if (!_initialized && _selectedIds.Count == 0 && _availableParticipants.Count > 0)
|
||||||
{
|
{
|
||||||
|
_initialized = true;
|
||||||
await SelectAll();
|
await SelectAll();
|
||||||
}
|
}
|
||||||
|
_initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ToggleParticipant(Guid personId)
|
private async Task ToggleParticipant(Guid personId)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue