Skip to content

Commit

Permalink
[sitecore-jss-nextjs] Links inside RichText control cause page to be …
Browse files Browse the repository at this point in the history
…loaded twice (#659)

* Fix internal links initialization

* Add doc
  • Loading branch information
illiakovalenko authored Apr 27, 2021
1 parent 84e256a commit 4a07ae1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/data/routes/release-notes/en.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ There are [migration instructions](/upgrade-guides/18.0) from JSS 16-based appli

### Bug Fixes

* [PR #659](https://github.com/Sitecore/jss/pull/659) [sitecore-jss-nextjs] Links inside RichText control cause page to be loaded twice
* [PR #624](https://github.com/Sitecore/jss/pull/624):
* [sitecore-jss-react-native] [Image] Pass Object `style` type for `SvgUrI` instead of Array.
* [sitecore-jss-react-native] [Date] Always render `<HtmlView/>` if `editable` is provided.
Expand Down
3 changes: 1 addition & 2 deletions packages/sitecore-jss-nextjs/src/components/RichText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const RichText = (props: RichTextProps): JSX.Element => {
if (hasText && !isEditing) {
initializeLinks();
}
});
}, []);

const routeHandler = (ev: MouseEvent) => {
if (!ev.target) return;
Expand All @@ -56,7 +56,6 @@ export const RichText = (props: RichTextProps): JSX.Element => {
prefetched[link.pathname] = true;
}

link.removeEventListener('click', routeHandler, false);
link.addEventListener('click', routeHandler, false);
});
};
Expand Down

0 comments on commit 4a07ae1

Please sign in to comment.