Skip to content

Commit

Permalink
fix: use parameter v instead of version
Browse files Browse the repository at this point in the history
  • Loading branch information
usefulthink committed Feb 1, 2024
1 parent cb1336f commit 0626fb6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/__tests__/api-provider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ test('passes parameters to GoogleMapsAPILoader', () => {
expect(apiLoadSpy.mock.lastCall[0]).toMatchObject({
key: 'apikey',
libraries: 'places,marker',
version: 'beta',
v: 'beta',
language: 'en',
region: 'us',
authReferrerPolicy: 'origin'
Expand Down
7 changes: 4 additions & 3 deletions src/components/api-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function useMapInstances() {
* @param props
*/
function useGoogleMapsApiLoader(props: APIProviderProps) {
const {onLoad, apiKey, libraries = [], ...otherApiParams} = props;
const {onLoad, apiKey, version, libraries = [], ...otherApiParams} = props;

const [status, setStatus] = useState<APILoadingStatus>(
GoogleMapsApiLoader.loadingStatus
Expand All @@ -114,8 +114,8 @@ function useGoogleMapsApiLoader(props: APIProviderProps) {

const librariesString = useMemo(() => libraries?.join(','), [libraries]);
const serializedParams = useMemo(
() => JSON.stringify(otherApiParams),
[otherApiParams]
() => JSON.stringify({apiKey, version, ...otherApiParams}),
[apiKey, version, otherApiParams]
);

const importLibrary: typeof google.maps.importLibrary = useCallback(
Expand Down Expand Up @@ -146,6 +146,7 @@ function useGoogleMapsApiLoader(props: APIProviderProps) {
await GoogleMapsApiLoader.load(
{
key: apiKey,
v: version,
libraries: librariesString,
...otherApiParams
},
Expand Down

0 comments on commit 0626fb6

Please sign in to comment.