formio.js icon indicating copy to clipboard operation
formio.js copied to clipboard

FIO 7733: move polyfill to conditional lazy import

Open brendanbond opened this issue 1 year ago • 0 comments

Link to Jira Ticket

https://formio.atlassian.net/browse/FIO-7733

Description

Next.js, the now de-facto standard React framework, incorporates both a server-side rendering phase along with a client-side rendering phase. This requires dependencies to be relatively isomorphic, or at least to account for globals like window possibly not being present in the runtime environment.

This PR makes such a change by conditionally importing the AbortController polyfill only when it's needed and only if the browser runtime does not support it.

Breaking Changes / Backwards Compatibility

n/a

Dependencies

n/a

How has this PR been tested?

Existing tests around multi-part upload (where AbortController appears) continue to pass

Checklist:

  • [x] I have completed the above PR template
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I have made corresponding changes to the documentation (if applicable)
  • [x] My changes generate no new warnings
  • [x] My changes include tests that prove my fix is effective (or that my feature works as intended)
  • [x] New and existing unit/integration tests pass locally with my changes
  • [x] Any dependent changes have corresponding PRs that are listed above

brendanbond avatar Feb 08 '24 17:02 brendanbond