Skip to content

Conversation

@Gnito
Copy link
Contributor

@Gnito Gnito commented Dec 31, 2025

TODO: when bounds are coming from URL, the Google Maps is causing an error. (window.google.maps exists, but instances don't match)

Map library is shown on some of the pages, but ReusableMapContainer is used app wide. Because of ReusableMapContainer setup, the library should be available app-wide after initial page load.
However, we can defer the map library loading on pages that don't show the map immediately.

Note: SearchPageWithMap and ListingPage are showing maps by default. If you have customized your client app to show map on some other page, you should add prioritizeMapLibraryLoading: true flag to the route configuration of your custom page.

Steps:

  1. Check what was the initial path/route when full page load was made (and this Single Page App was initialized).
  2. Decide whether to add defer attribute to those script elements based on route configuration.

How the defer attribute for script elements behaves:
https://dev.to/fidalmathew/async-vs-defer-in-javascript-which-is-better-26gm

Gnito added 3 commits January 2, 2026 11:15
(except SearchPageWithMap and ListingPage).
Due to ReusableMapContainer setup, the library should be available
app-wide after initial page load (hence just deferring the fetch).
It is used for geocoding (on topbar search), basically on every page.
However, only as a reaction to written string on LocationAutocompleteInput.
@Gnito Gnito force-pushed the defer-map-scripts branch from 2c1e887 to 2979f40 Compare January 2, 2026 09:18
@Gnito Gnito changed the title Defer map library loading WiP: defer map library loading Jan 2, 2026
@Gnito Gnito closed this Jan 2, 2026
@Gnito Gnito reopened this Jan 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants