Skip to content

Conversation

@sean-perkins
Copy link
Contributor

@sean-perkins sean-perkins commented Feb 8, 2023

The DomParser class is not available in a server context (only available in the browser). The previous changes were causing issues in SSR when trying to load an icon.

This PR removes the implementation of instantiating the DomParser, regardless of the environment.

Resolves: #1179

Copy link
Contributor

@liamdebeasi liamdebeasi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with dev build 6.1.3-dev.11675958242.15132c48 on the repo provided in #1179, and this fix seems to work.

I don't know if we need the Build.isBrowser flag here and in the Icon component:

if (Build.isBrowser && this.isVisible) {

getSvgContent is only called if Build.isBrowser is true in loadIcon, so adding the Build check in getSvgContent seems redundant.

The original problem was that we were running new DOMParser() regardless of environment.

@sean-perkins sean-perkins marked this pull request as ready for review February 9, 2023 16:38
@sean-perkins sean-perkins merged commit 8c412f6 into main Feb 9, 2023
@sean-perkins sean-perkins deleted the fix/ionicons-ssr branch February 9, 2023 17:30
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.

bug: DOMParser is not defined

3 participants