Refactor alias filter select component to prevent automatic reset of selected alias
- Updated logic in the alias filter select component to avoid resetting the selected alias to "all" during loading when the available aliases may be temporarily empty. - Ensured that the selected value defaults to "all" only if no value is provided.
This commit is contained in:
@@ -14,12 +14,10 @@
|
|||||||
} = $props();
|
} = $props();
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
if ((value ?? "all") !== "all" && !availableAliases.includes(value ?? "all")) {
|
// Не сбрасываем выбранный alias автоматически:
|
||||||
value = "all";
|
// во время загрузки список может быть временно пустым, что
|
||||||
}
|
// приводило к возврату на "all" сразу после выбора.
|
||||||
if (!value) {
|
if (!value) value = "all";
|
||||||
value = "all";
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let selectedLabel = $derived((value ?? "all") === "all" ? allLabel : (value ?? "all"));
|
let selectedLabel = $derived((value ?? "all") === "all" ? allLabel : (value ?? "all"));
|
||||||
|
|||||||
Reference in New Issue
Block a user