EmmanuelRoux / ngx-matomo-client

Matomo analytics client for Angular applications
https://matomo.org/
MIT License
74 stars 16 forks source link

fix(router): retrieve Base Href from LocationStrategy instead #83

Closed Viserius closed 10 months ago

Viserius commented 10 months ago

Attempt to resolve #82. Unfortunately, does not solve the exception as it still gets a null-value for the base href, but at least it does not call PlatformLocation anymore.

EmmanuelRoux commented 10 months ago

@Viserius As mentionned in #82, base href can actually be null (despite Angular typing is incorrectly not reflecting that).

If you want to work on a fix, maybe a quick solution is to simply add an empty string as default value in page-url-provider.ts#L42 (added ?? '')

  private getBaseHrefWithoutTrailingSlash(): string {
    return trimTrailingSlash(this.baseHref ?? this.platformLocation.getBaseHrefFromDOM() ?? '');
  }

(Please don't forget to add a very simple test case for that)

Viserius commented 10 months ago

@EmmanuelRoux I have tested your suggestion and this solves #82 . I have implemented your suggestion in this PR.

EmmanuelRoux commented 10 months ago

@Viserius Thank you very much! 😊 It will be released in few minutes

EmmanuelRoux commented 10 months ago

:tada: This PR is included in version 6.0.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

Viserius commented 10 months ago

@EmmanuelRoux Thank you for collaborating!