Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit side effects of polyfills loaded for config/I18n #2907

Closed
1 task
romaricpascal opened this issue Oct 10, 2022 · 0 comments · Fixed by #2959
Closed
1 task

Limit side effects of polyfills loaded for config/I18n #2907

romaricpascal opened this issue Oct 10, 2022 · 0 comments · Fixed by #2959
Assignees
Milestone

Comments

@romaricpascal
Copy link
Member

What

Ensure only components needing the dataset, closest and possibly trim polyfills import them. This'll help reduce bundle size for non-configurable or non-internationalisable components.

Possible approach could be to:

  • make a separate module for closestAttributeValue that imports Element.prototype.closest
  • make a separate module for normaliseString that imports String.prototype.trim
  • import Element.prototype.dataset in all components requiring configuration as they access the dataset. Given that one will be an easy one to miss, I wonder if we shouldn't have a getDataset function that has side effect.

These files could live in an src/polyfilled folder that we'll revisit for v5.

Why

@colinrotherham wrote a neat explanation in this comment: #2887 (comment)

Who needs to work on this

Developers

Who needs to review this

Developers

Done when

  • Polyfills don't burden components that don't require them when the components are imported individually
@romaricpascal romaricpascal added the awaiting triage Needs triaging by team label Oct 10, 2022
@36degrees 36degrees added this to the [NEXT] milestone Oct 11, 2022
@36degrees 36degrees added this to Backlog 🗄 in Design System Sprint Board via automation Oct 11, 2022
@36degrees 36degrees moved this from Backlog 🗄 to Sprint Backlog 🏃🏼‍♀️ in Design System Sprint Board Oct 11, 2022
@romaricpascal romaricpascal self-assigned this Nov 2, 2022
@romaricpascal romaricpascal moved this from Sprint Backlog 🏃🏼‍♀️ to In progress 📝 in Design System Sprint Board Nov 2, 2022
@kellylee-gds kellylee-gds added Frontend squad and removed awaiting triage Needs triaging by team labels Nov 3, 2022
@romaricpascal romaricpascal moved this from In progress 📝 to Needs review 🔍 in Design System Sprint Board Nov 3, 2022
@romaricpascal romaricpascal moved this from Needs review 🔍 to Ready to release 🚀 in Design System Sprint Board Nov 7, 2022
@36degrees 36degrees moved this from Ready to release 🚀 to Done 🏁 in Design System Sprint Board Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

3 participants