carbon-design-system / carbon

A design system built by IBM
https://www.carbondesignsystem.com
Apache License 2.0
7.83k stars 1.81k forks source link

[CodeSnippet] remove resize observer polyfill #8271

Open tay1orjones opened 3 years ago

tay1orjones commented 3 years ago

Summary

As IE11 will no longer be supported in v11 we will be able to remove the resize observer polyfill we use through use-resize-observer. Right now this is only used in CodeSnippet.

https://github.com/carbon-design-system/carbon/blob/ce5a810bb3aa5e802cdf00a5a9e1e83e3254b1f2/packages/react/src/components/CodeSnippet/CodeSnippet.js#L11

Justification

The polyfill is only an additional 2.44kb in size to the bundle but we won't need it anymore. It's a super small change:

- import useResizeObserver from 'use-resize-observer/polyfilled';
+ import useResizeObserver from 'use-resize-observer';
tay1orjones commented 1 year ago

I think this will unblock adding the codesandbox CI. I tried configuring it in https://github.com/carbon-design-system/carbon/pull/12029 but codesandbox had issues resolving this relative import for some reason. Without it, we'll probably have no issues and could re-add it.

sstrubberg commented 1 year ago

It's a one-line change, but how do we test it with some component that uses use-resize-observer? It's only used in CodeSnippet. It relates to the collapsing of rows. We need to make sure it works with all the browsers.

This will unblock us from use Codesandbox CLI. Giving us a pre-generated Codesandbox link for the changes in that given PR. This will also unload responsibility on Storybook stories that we often generate.