Merge pull request 'fix: Reset tariff fraction selector state and clear fractions only when the modal is initially opened.' (#146) from feature/fraction-API into development

Reviewed-on: ADUANASOFT/anexo76#146
This commit is contained in:
2026-02-16 19:00:04 +00:00

View File

@@ -23,18 +23,21 @@
let isLoadingFractions = $state(false);
let searchTimeout: ReturnType<typeof setTimeout>;
// Cargar datos al abrir
let wasOpen = $state(false);
// Cargar datos al abrir
$effect(() => {
if (open) {
// Reiniciar estado al abrir
if (tariffFractions.length === 0) {
searchFraction = '';
currentPage = 1;
totalFractions = 0;
hasMoreFractions = true;
loadFractions('', 1);
}
if (open && !wasOpen) {
// Reiniciar estado SOLO al abrir
searchFraction = '';
currentPage = 1;
totalFractions = 0;
hasMoreFractions = true;
tariffFractions = [];
loadFractions('', 1);
}
wasOpen = open;
});
async function loadFractions(search: string, page: number = currentPage) {