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

[BUG] Make table size adjustable according to table rows and columns #5514

Closed
wants to merge 1 commit into from

Conversation

ananzh
Copy link
Member

@ananzh ananzh commented Nov 20, 2023

Description

Auto-resized issue is caused by we have a central discover context created useSearch.
When it is updated, both panel and canvas which use useDiscoverContext will render.
The update on panel will trigger useSearch and cause canvas render before update is done.
Therefore when table might not be fully re-rendered and just use the current table space.
It appears that the main challenge is ensuring that DiscoverTable fully re-renders when the rows changes.

  • This PR uses the length of the rows and a combination of last column that uniquely identify the state of the rows as the key.
  • The last column name is helpful to make sure add/remove column will trigger fully re-render. For example, since _source takes multiple lines so we will see extra empty space at the bottom when we add a column. Since add/remove column always update last one, by add last column name as a key, we won't see extra space by fully re-render.

We could do more optimization after 2.12.

Issues Resolved

#5440

Screenshot

fix-multiline.mov

Testing the changes

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@ananzh ananzh changed the title [BUG] Resolve display issue and improve performance [BUG] Resolve display issue and improve performance in Discover Nov 20, 2023
@ananzh ananzh added bug Something isn't working v2.12.0 labels Nov 20, 2023
Copy link

codecov bot commented Nov 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7c0bd9f) 67.01% compared to head (51e04f8) 67.01%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5514   +/-   ##
=======================================
  Coverage   67.01%   67.01%           
=======================================
  Files        3296     3296           
  Lines       63370    63370           
  Branches    10093    10093           
=======================================
  Hits        42465    42465           
  Misses      18456    18456           
  Partials     2449     2449           
Flag Coverage Δ
Linux_1 35.23% <ø> (ø)
Linux_2 55.12% <ø> (ø)
Linux_3 43.93% <ø> (ø)
Linux_4 35.33% <ø> (ø)
Windows_1 35.26% <ø> (ø)
Windows_2 55.09% <ø> (ø)
Windows_3 43.93% <ø> (ø)
Windows_4 35.33% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ananzh ananzh force-pushed the fix-5440 branch 2 times, most recently from c3936e2 to f228a85 Compare January 29, 2024 23:31
@ananzh ananzh added the discover for discover reinvent label Jan 29, 2024
@ananzh
Copy link
Member Author

ananzh commented Jan 29, 2024

There are two functional tests broken by reload. If we think this could be a tmp fix, I could fix the tests as well.

* Provide a unique key prop to the table component to force it to fully
re-render when the key changes, which will force table to adjust its size.

Issue Resolved
opensearch-project#5440

Signed-off-by: Anan Z <ananzh@amazon.com>
@ananzh ananzh changed the title [BUG] Resolve display issue and improve performance in Discover [BUG] Make table size adjustable according to table rows and columns Feb 5, 2024
@@ -53,6 +53,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [Discover] Fix missing index pattern field from breaking Discover [#5626](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5626)
- [BUG] Remove duplicate sample data as id 90943e30-9a47-11e8-b64d-95841ca0b247 ([5668](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5668))
- [BUG][Multiple Datasource] Fix datasource testing connection unexpectedly passed with wrong endpoint [#5663](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5663)
- [BUG][Discover] Make table size adjustable according to table rows and columns ([#5514](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5514))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- [BUG][Discover] Make table size adjustable according to table rows and columns ([#5514](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5514))
- [Discover] Make table size adjustable according to table rows and columns ([#5514](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5514))

@ananzh
Copy link
Member Author

ananzh commented Feb 7, 2024

close this since the issue is fixed

@ananzh ananzh closed this Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working discover for discover reinvent distinguished-contributor v2.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants