Wykks / ngx-mapbox-gl

Angular binding of mapbox-gl-js
https://wykks.github.io/ngx-mapbox-gl
MIT License
344 stars 139 forks source link

fix: set baseApiUrl rather than assign config.API_URL which is now a getter #395

Closed sandikbarr closed 1 year ago

sandikbarr commented 1 year ago

As mentioned in #390 setting the customMapboxApiUrl on the map component is throwing an error that it is unable to set property API_URL on config which is now a getter.

ngx-mapbox-gl.mjs:767 Uncaught TypeError: Cannot set property config of [object Module] which has only a getter
    at MapService.assign (ngx-mapbox-gl.mjs:767:1)
    at ngx-mapbox-gl.mjs:34:1
    at Object.next (Subscriber.js:123:1)
    at Subscriber._next (Subscriber.js:63:1)
    at Subscriber.next (Subscriber.js:34:1)
    at throwIfEmpty.js:10:1
    at OperatorSubscriber._this._next (OperatorSubscriber.js:11:1)
    at Subscriber.next (Subscriber.js:34:1)
    at take.js:12:1
    at OperatorSubscriber._this._next (OperatorSubscriber.js:11:1)

Mapbox provides a baseApiUrl option that can be set on mapboxgl, example:

mapboxgl.baseApiUrl = 'https://api.mapbox.com';

How to test: Set the customMapboxApiUrl input on the map component using the default value for Mapbox Cloud, "https://api.mapbox.com" (I am using this with an alternate Mapbox url, but the error will be shown if the config.API_URL is assign when customMapboxApiUrl is set.)

nx-cloud[bot] commented 1 year ago

☁️ Nx Cloud Report

We didn't find any information for the current pull request with the commit a8c942691090ef793c59402b60ad763ebab72ee0. You might need to set the 'NX_BRANCH' environment variable in your CI pipeline.

Check the Nx Cloud Github Integration documentation for more information.


Sent with 💌 from NxCloud.

sandikbarr commented 1 year ago

@Wykks any thoughts on this fix?

Wykks commented 1 year ago

Hi!

Looks good to me! Sorry for the delay