Is it a Wix Error? Same code showing two results

I’ve used the code to show repeaters items. It’s working fine as the sum of the items is always correct. Then I add a dropdown to filter the repeater items. I’m getting different responses every time without making any change to the code. Sometimes it’s shows correctly and sometimes it shows NaN?

"Only change is filter where an extra condition is added.

Also, during fast change on dropdown using onkeypress sometimes it shows wrong result. Please let me know either I’ve made a mistake or Wix has some error for this.

import wixData from 'wix-data';
import wixUsers from 'wix-users';
import wixSearch from 'wix-search';
import { local } from 'wix-storage';
import wixWindow from 'wix-window';

$w.onReady(() => {
    console.log(($w('#dropdown1').value));
     $w('#dataset1').onReady( () => {
         debitsum();
     $w('#dataset1').setFilter(wixData.filter().eq("_owner", wixUsers.currentUser.id))
        .then((results) => {
            $w('#repeater1').forEachItem(($item) => {
 var getting = parseFloat($item("#text19").text);
 if ($item("#text20").text === "Debit") {
 var value = (-1 * getting);
                    $item("#text19").html = "<p style='font-size: 25px; font-style: avenir; text-align: right; color: red;'>" + value.toLocaleString('en-IN', {
                        maximumFractionDigits: 2,
                        style: 'currency',
                        currency: 'INR'
                    }); + "</p>";
                } else {
 var value = getting;
                    $item("#text19").html = "<p style='font-size: 25px; font-style: avenir; text-align: right; color: green;'>" + value.toLocaleString('en-IN', {
                        maximumFractionDigits: 2,
                        style: 'currency',
                        currency: 'INR'
                    }); + "</p>";
                }

            })
        })
    $w('#dropdown1').onChange(() => {
    local.clear();
    debitsum2();
    $w('#dataset1').setFilter(wixData.filter().eq("_owner", wixUsers.currentUser.id).eq("expenseFor", $w('#dropdown1').value))
        .then((results) => {
            console.log(results.items[0].type);
            $w('#repeater1').forEachItem(($item) => {
 var getting = parseFloat($item("#text19").text);
 if ($item("#text20").text === "Debit") {
 var value = (-1 * getting);
                    $item("#text19").html = "<p style='font-size: 25px; font-style: avenir; text-align: right; color: red;'>" + value.toLocaleString('en-IN', {
                        maximumFractionDigits: 2,
                        style: 'currency',
                        currency: 'INR'
                    }); + "</p>";
 //$w("#text19").html = "<p style='font-size: 25px; font-style: avenir; text-align: right; color: #D12020;'>" + value + "</p>";
                } else {
 var value = getting;
 // console.log("Else Running")
                    $item("#text19").html = "<p style='font-size: 25px; font-style: avenir; text-align: right; color: green;'>" + value.toLocaleString('en-IN', {
                        maximumFractionDigits: 2,
                        style: 'currency',
                        currency: 'INR'
                    }); + "</p>";
                }

            })
        })

    })
     });
});