Skip to content

21.0.0 - Async & Performance

Compare
Choose a tag to compare
@joerideg joerideg released this 27 Apr 03:25
· 252 commits to main since this release

TLDR;

  • Reverted async behavior in methods so we can fully render HTML on the server again, go SSR!
  • Removed sanitize, prepareHTML methods and useHTML hook
  • Make sure you preserve data-type attributes on links when you sanitize the content from rich text fields with the sanitize library of your choosing

Changes

In this release, we have focused on streamlining the API and reducing the size of the @bloomreach/spa-sdk. We have reverted some of the changes introduced in versions 18.0.0 and 18.0.1, removed the page.sanitize method to allow for making the library lighter, and removed some dependencies to significantly reduce the bundle size. We have also ensured compatibility with server-side rendering (SSR) in React and Vue.

(BREAKING) REVERTED CHANGES:

Reverted the changes introduced in 18.0.0:

  • Page.rewriteLinks now returns string instead of Promise
  • Removed the prepareHTML method and the useHTML React hook as they were created to easily combine the sanitize method with the rewriteLinks method. With the removal of the sanitize method, they are no longer useful additions.

Reverted the changes introduced in 18.0.1:

  • initialize now returns Page | Promise instead of Promise

The reason for reverting these changes is to support SSR in React and Vue. The asynchronous nature of the previously introduced changes conflicted with the synchronous nature of the React and Vue SSR APIs.

OTHER BREAKING CHANGES:

  • Removed the sanitize method from the Page object to reduce the size of the library

RECOMMENDATIONS:

We strongly recommend that you sanitize any HTML content returned in the page model. Before the removal of the sanitize method, we used the sanitize-html package in the SDK for this purpose. You can now use your preferred sanitation libraries or techniques based on your project requirements. Make sure to preserve the data-type attribute on links in the rich content fields when sanitizing as it lets the SDK determine which links are external and which are internal when using the rewriteLinks method.

ADDITIONAL NOTES:

  • We have removed the '@xmldom/xmldom' and 'sanitize-html' dependencies, reducing the bundle size by about 50% compared to version 17 of the SDK. This results in faster load times and improved performance for your applications.
  • We have added a CJS bundle output for the relevance express.js module

As always, we appreciate your feedback and suggestions for improving the @bloomreach/spa-sdk. Please feel free to reach out to us with any questions or concerns.