opensearch-project / OpenSearch-Dashboards

📊 Open source visualization dashboards for OpenSearch.
https://opensearch.org/docs/latest/dashboards/index/
Apache License 2.0
1.67k stars 874 forks source link

Replace usage of `resize-observer-polyfill` dependency #3824

Open abbyhu2000 opened 1 year ago

abbyhu2000 commented 1 year ago

resize-observer-polyfill is a JavaScript library that provides a way to observe changes to the size of elements in the browser's viewport. It works by adding a ResizeObserver API to browsers that do not natively support it, allowing developers to use this functionality in their projects.

Task: Drop the usage of libraries resize-observer-polyfill in favor of more performant native implementations.

Usage:

  1. Usage of ResizeObserver in src/plugins/data/public/ui/search_bar/search_bar.tsx
public ro = new ResizeObserver(this.setFilterBarHeight);
  1. Usage of ResizeObserver in class ResizeChecker in src/plugins/opensearch_dashboards_utils/public/resize_checker/resize_checker.ts and resize_checker.test.ts
observer = new ResizeObserver(() => {
      if (this.expectedSize) {
        const sameSize = isEqual(getSize(el), this.expectedSize);
        this.expectedSize = null;

        if (sameSize) {
          // don't trigger resize notification if the size is what we expect
          return;
        }
      }

      this.emit('resize');
    });
sayuree commented 1 year ago

Hi, I want to work on this issue

abbyhu2000 commented 1 year ago

@sayuree I assigned #3822 (removing deep-freeze-strict dependency) to you. Do you want to work on that first? Once that is finished, can assign this next.

sayuree commented 1 year ago

@abbyhu2000 I have finished #3822 and submitted a PR on that issue. Until the changes are being reviewed, I want to work on this issue.