formio / formio.js

JavaScript powered Forms with JSON Form Builder
https://formio.github.io/formio.js
MIT License
1.89k stars 1.06k forks source link

FIO 7733: move polyfill to conditional lazy import #5506

Closed brendanbond closed 6 months ago

brendanbond commented 9 months ago

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: