Dataset info takes too much time to load

Im making a website for a last mile delivery service.
The page has a form to sumbit the pick up and delivery request, the 2 first fields has to auto complete with the dataset info and one more field has to auto complete with a permanent value.

The problem is that when the “pick up and delivery” page loads, the auto complete fields take too long to load the information (sometimes even minutes).
Here is my code (the tags are in spanish):


Here is my code: 
import wixLocation from 'wix-location';

$w.onReady(function () {

       $w("#nombre").value =$w('#clientesDataset').getCurrentItem().nombre //

       $w("#direccion").value =$w('#clientesDataset').getCurrentItem().direccion //

       $w("#Fechayhora").value ="Today at 8PM EST"

$w('#cargarEnvio').onClick(function (){    
            wixLocation.to(wixLocation.url);
            })

});

This is how the page looks (the last field goes hidden):

On the other hand, at “my account” page the information loads pretty fast (“Rodrigo”, “Demostenes 3532” and the phone number).

I would appreciate if somebody can help me to make de auto complete forms load faster.

Rodrigo, when the page onReady handler runs, the dataset that you are trying to access is not necessarily loaded yet. That calls for an onReady for the dataset as well. You will see this thoroughly explained in the documentation for getCurrentItem .

There may be other reasons for the slow loading of the dataset, but start with that to see if you see an improvement.

$w.onReady(function(){
	$w("#clientesDataset").onReady( () => {
  	   $w("#nombre").value=$w('#clientesDataset').getCurrentItem().nombre;
	   $w("#direccion").value=$w('#clientesDataset').getCurrentItem().direccion;
           $w("#Fechayhora").value="Today at 8PM EST";
	} );
});

Hi Anthony, thank you for your response!

Now the fields data shows pretty quickly.

Thank you very much for your help!