Skip to main content
alexanderf022406
September 16, 2025
Question

GOOGLE MAPS PLUGIN, THE MAP FREEZES

  • September 16, 2025
  • 5 replies
  • 0 views

Hello, the truth is that the problem I have may sound very strange, but it is something related to Google Maps or the plugin. It happens that the map freezes, here I will leave my code and explain exactly what it does, the first thing is a pickerFieldCustom in which the user will enter an address close to their house and that address calls the Maps API to recommend addresses and then when selecting an address, the service is used to bring the latitude and longitude, it is here that this data is passed to the component that displays the map and where it seems to freeze.

a!localVariables(
  local!data: {},
  local!coordenadas,
  {
    a!cardLayout(
      contents: {
        a!pickerFieldCustom(
          label: "Direccion de Asistencia",
          suggestFunction: rule!CT_autocompletarDireccion(address: _),
          selectedLabels: local!data,
          value: ri!registroSiniestro.direccionAsistencia,
          saveInto: {
            local!data,
            ri!registroSiniestro.direccionAsistencia,
            ri!datosAsistencia.DireccionAsistencia,
            a!save(
              local!coordenadas,
              index(
                index(
                  rule!CT_obtenerLatitudyLongitud(
                    address: ri!registroSiniestro.direccionAsistencia
                  ),
                  1
                ).data,
                1
              ).geometry
            ),
            a!save(
              ri!registroSiniestro.latitud,
              local!coordenadas.lat
            ),
            a!save(
              ri!registroSiniestro.longitud,
              local!coordenadas.lng
            )
          },
          maxSelections: 1,
          
        ),
        googleMapsPinField(
          googleMapsApiKey: cons!CT_API_KEY_GOOGLEMAPS,
          enableZoom: true,
          enablePanning: true,
          mapCenter: {
            lat: local!coordenadas.lat,
            lng: local!coordenadas.lng
          },
          mapMarker: {
            lat: local!coordenadas.lat,
            lng: local!coordenadas.lng
          },
          onPinDropped: {
            local!coordenadas,
            a!save(
              {
                ri!registroSiniestro.direccionAsistencia,
                local!data
              },
              index(
                rule!CT_obtenerLatitudyLongitud(
                  latitud: local!coordenadas.lat,
                  longitud: local!coordenadas.lng,
                  
                ),
                1
              ).data.formattedAddress
            )
          },
          zoomLevel: 11
        )
      }
    )
  }
)

Here comes the weirdest part of the problem: the map refreshes when I switch from "Previewing" to "Editing" mode or vice versa. This behavior is quite strange. Help, please.

5 replies

shubhama926776
September 16, 2025

Strange to see this issue but i would recommend 2 approach to try,

1) Initialize local!coordenadas with default values at the start.
Or
2) Add a refresh variable to force the map to re-render:

a!localVariables(
  local!data: {},
  local!coordenadas,
  local!refreshMap: false(),
  {
    /* In your saveInto, add: */
    a!save(local!refreshMap, not(local!refreshMap)),

    /* Wrap your googleMapsPinField in a conditional: */
    if(
      or(isnull(local!coordenadas), local!refreshMap, not(local!refreshMap)),
      googleMapsPinField(
        /* your existing map config */
      ),
      {}
    )
  }
)

Let me know if that works for you.

alexanderf022406
September 16, 2025

Hi, thank you so much. With the first step it works. It seems that is necessary set a default value.

shubhama926776
September 16, 2025

Great to hear that.
Map components crash when initialized with null/undefined coordinates but work fine with any valid starting values. It's a common issue where the map needs valid lat/lng to create its initial view.

stefanhelzle0001
September 16, 2025

Do you see this behaviour only in the editor or also in a site or user input task?

alexanderf022406
September 16, 2025

Hi, in both. The same thing happens to me in both cases, with the difference that in the user input task there is no way to change modes and the map remains completely frozen.