Problem/Motivation

When a View has an attachment set to a display which use Geofield Google Map formatter and has caching enabled and AJAX enabled, the map will disappear on subsequent filter applies. The first time a filter is applied, it will work and the map updates. After the first apply, other attempts will result in the map not loading when using the same filter criteria.

Steps to reproduce

  1. Install latest Drupal 10.3 and geofield_map 3.0.20
  2. Create a new node type to store map markers with 1 geofield field
  3. Add a couple of instances of the previously created node type
  4. Create a View to show the previously created node type
  5. Create 1 display as an attachment and 1 display as a page
  6. Add a filter to the view and expose it
  7. Add the geofield field and title to the view
  8. Set the attachment display to use Geofield Google Map format and use the geofield field from before
  9. Attach the previously created attachment display to the page display
  10. Enable caching and AJAX for the view
  11. Visit the page with the view and apply the filter
  12. The first time it will work. Subsequent tries will result in the map not loading

See this screen recording for an example of the issue.

Proposed resolution

  • Remove the check for an existing entry in map_data. When the filter is applied subsequently, the mapId used is the same and an entry already exists in map_data so loadMap() does not get called resulting in a missing map.
  • Remove extra check if mapId exists in drupalSettings since it happens earlier
  • The change above will cause the map to reload everytime it comes into view if lazyload is enabled. To prevent this, use once().

See recording of proposed fix.

Remaining tasks

  • Test if there are any unintended consequences. So far works well!
CommentFileSizeAuthor
#9 Proposed Fix.gif4.64 MBiamfil
#8 Issue 3465832.gif1.58 MBiamfil
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

iamfil created an issue. See original summary.

iamfil’s picture

Version: 3.0.20 » 3.0.x-dev
iamfil’s picture

Version: 3.0.x-dev » 3.0.20
iamfil’s picture

Title: Map does not update when appyling filter in Views with AJAX enabled » Map does not update when reappyling filter in View with caching enabled
itamair’s picture

Category: Bug report » Support request
Status: Active » Closed (cannot reproduce)

Bugs cannot be reported in this easy way, with no evidence and with this clear lack of context and information.
You don't provide:
- any description of what you experience;
- any clear/objective evidence that it is a general Bug, and not caused by a potential custom setup of your project environment;
- you don't provide any information on how to clearly (and objectively) reproduce what you report ...
- you don't also provide any screenshot of what you report, to better help who is supposed to support and re-act on this ...

On the minimal info you provide only in your title (that you also changed) I cam say that all is working good on the Geofield Map side (
3.0.20), on the Geofield Map View, with Proximity Filter, Ajax and Cache enable,
as you can check from this demo Goofield Map Page: https://www.geodemocracy.com/drupal_geofield_stack_demo/web/

Hence, I am moving this into normal Support Request and Closing as cannot reproduce.
Please reopen this only providing proper and detailed documentation, and info on how to reproduce your use case.

Set this as Bug ONLY if you can provide clear and objective way that it is a General Bug, and not an assumed one on something on your side that doesn't behave the way you expect (and that could depend by so many things from your setup).

iamfil’s picture

Title: Map does not update when reappyling filter in View with caching enabled » Map disappears on subsequent filters when attached to a View with caching and AJAX enabled
Category: Support request » Bug report
Issue summary: View changes
Status: Closed (cannot reproduce) » Active
iamfil’s picture

Sorry about the lack of initial information! I was interrupted while working on this.

iamfil’s picture

Issue summary: View changes
StatusFileSize
new1.58 MB
iamfil’s picture

Issue summary: View changes
StatusFileSize
new4.64 MB

  • itamair committed 223c22ac on 3.0.x authored by iamfil
    Issue #3465832 by iamfil: Map disappears on subsequent filters when...
itamair’s picture

Status: Active » Fixed

thanks a lot @iamfil ... I QAed and Tested your MR!19 and it looks having much sense and not introducing any evident regression (also in the Lazy Load ...).
thus I merged it into the 3.0.x branch. All this will be parto of the next incoming Leaflet module release,

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.