Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jan 30, 2024

Conversation

Viserius
Copy link
Contributor

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 EmmanuelRoux added the bug Something isn't working label Jan 30, 2024
@EmmanuelRoux
Copy link
Owner

@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
Copy link
Contributor Author

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

@EmmanuelRoux
Copy link
Owner

EmmanuelRoux commented Jan 30, 2024

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

@EmmanuelRoux EmmanuelRoux merged commit 73e8442 into EmmanuelRoux:main Jan 30, 2024
5 checks passed
@EmmanuelRoux
Copy link
Owner

🎉 This PR is included in version 6.0.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Viserius
Copy link
Contributor Author

@EmmanuelRoux Thank you for collaborating!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Importing MatomoRouterModule results in Error retrieving getBaseHrefFromDOM
2 participants