-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NextJS] Add prefetchLinks parameter to RichText component (#1517)
* Fix internal link issue in NextJs RichText Subsequent pages don't have client side routing Added a useEffect dependancy to the NextJs RichText component. This fixes an issue where where the useEffect() hook doesn't run when navigating to a page that contains a RichText component after clicking an internal link in a RichText component on another page to cause the navigation. Description: 1. Open a page that contains a RichText component that has an <a> tag that links to a page within the same site (i.e. clicking the link fires the routeHandler() function within the richText component that performs a client side navigation) 2. When the RichText component on the new page renders, it doesn't run the useEffect hook so the event handler doesn't get attached to any internal links within the RichText component 3. Clicking on any of the embedded links causes a whole page refresh as the event handler isn't attached, so no client side routing occurs. * Make link prefetching configurable in RichText Add 'prefetchLinks' parameter to NextJs RichText component to allow users to turn prefetching of internal links on and off. This can reduce the amount of data fetch, particularly on a page with many links that are unlikely to be visited. * Added unit test for preftechLinks in RichText component * Updated chanelog for prefetchLinks parameter in NextJS RichText component
- Loading branch information
1 parent
dfb380c
commit 9a2c6b2
Showing
3 changed files
with
45 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters