Skip to content

Commit

Permalink
Merge pull request #257 from HybridFox/bugfix/ssr-rendering-icon
Browse files Browse the repository at this point in the history
fix(icon): ssr rendering
  • Loading branch information
TriangleJuice authored Oct 8, 2021
2 parents 7468e29 + 8bf2705 commit ce1ae05
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/).

## [Unreleased]

### Fixed
- `Icon` Fixed document reference

## v6.0.6 - 2021-10-08

Expand Down
3 changes: 2 additions & 1 deletion packages/icon/src/Icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const Icon = ({ name, style, className, ariaLabel, onClick, src, qa }: Props) =>
const xlinkHref = 'https://cdn.antwerpen.be/core_branding_scss/5.0.0/assets/images/ai.svg';
const response = await fetch(xlinkHref);
const svgText = await response.text();

const svgWrapper = document.createElement('svg');

svgWrapper.id = 'aiSvg';
Expand All @@ -41,7 +42,7 @@ const Icon = ({ name, style, className, ariaLabel, onClick, src, qa }: Props) =>
}
}

if(!document.getElementById('aiSvg')) {
if(typeof document !== 'undefined' && !document.getElementById('aiSvg')) {
fetchAntwerpIcons();
}

Expand Down

0 comments on commit ce1ae05

Please sign in to comment.