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

[Workspace] feat: optimize recent items and filter out items whose workspace is deleted #8900

Merged
merged 4 commits into from
Nov 27, 2024

Conversation

raintygao
Copy link
Contributor

Description

  1. optimize recent items
  2. filter out items whose workspace is deleted

Screenshot

No UI change

Testing the changes

  1. Update internal users to emit app updaters and recent items would not send extra request
  2. Filter out items whose workspace is deleted

Changelog

  • feat: Optimize recent items and filter out items whose workspace is deleted

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

Copy link

codecov bot commented Nov 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.87%. Comparing base (89265b6) to head (03c6825).
Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8900   +/-   ##
=======================================
  Coverage   60.87%   60.87%           
=======================================
  Files        3802     3802           
  Lines       91060    91060           
  Branches    14370    14370           
=======================================
+ Hits        55435    55436    +1     
+ Misses      32085    32084    -1     
  Partials     3540     3540           
Flag Coverage Δ
Linux_1 29.01% <0.00%> (ø)
Linux_2 56.38% <100.00%> (-0.01%) ⬇️
Linux_3 37.90% <0.00%> (?)
Linux_4 29.00% <0.00%> (ø)
Windows_1 29.03% <0.00%> (ø)
Windows_2 56.34% <100.00%> (-0.01%) ⬇️
Windows_3 37.90% <0.00%> (ø)
Windows_4 29.00% <0.00%> (ø)

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.

@@ -213,45 +226,45 @@ export const RecentItems = ({
type: item.meta?.type || '',
id: item.id,
}));

if (savedObjects.length) {
// Deep compare navLinks to avoid unnecessary requests
Copy link
Contributor

Choose a reason for hiding this comment

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

How about using useDeepCompareEffect instead? Current implementation won't be executed again after other dependencies(eg: recentlyAccessedItems or workspaceList ) changed but navLinks are same.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After offline discussion, we only need to deep compare navLinks because only its reference would be changed after appUpdater.

.href,
};
// If the workspace id is existing but the workspace is deleted, filter the item
if (recentAccessItem.workspaceId && !findWorkspace) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to check if workspace feature enabled here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If workspace feature is disabled, recentAccessItem would not have workspaceId.

raintygao pushed a commit to raintygao/OpenSearch-Dashboards that referenced this pull request Nov 20, 2024
SuZhou-Joe
SuZhou-Joe previously approved these changes Nov 21, 2024
Comment on lines 229 to 230
bulkGetDetail(savedObjects, http).then((res) => {
const filteredNavLinks = navLinks.filter((link) => !link.hidden);
const formatDetailedSavedObjects = res.map((obj) => {
const formatDetailedSavedObjects = res.flatMap((obj) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we do filtering by workspace before bulkGet as ChromeRecentlyAccessedHistoryItem has workspace already.

@SuZhou-Joe SuZhou-Joe merged commit c24d5bc into opensearch-project:main Nov 27, 2024
69 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Nov 27, 2024
…rkspace is deleted (#8900)

* feat: optimize recent items and filter out items whose workspace is deleted

Signed-off-by: tygao <[email protected]>

* Changeset file for PR #8900 created/updated

* seperate link

Signed-off-by: tygao <[email protected]>

* update filter sequence

Signed-off-by: tygao <[email protected]>

---------

Signed-off-by: tygao <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit c24d5bc)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
SuZhou-Joe pushed a commit that referenced this pull request Dec 3, 2024
…rkspace is deleted (#8900) (#8983)

* feat: optimize recent items and filter out items whose workspace is deleted



* Changeset file for PR #8900 created/updated

* seperate link



* update filter sequence



---------



(cherry picked from commit c24d5bc)

Signed-off-by: tygao <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
ArgusLi pushed a commit to ArgusLi/OpenSearch-Dashboards that referenced this pull request Dec 11, 2024
…rkspace is deleted (opensearch-project#8900)

* feat: optimize recent items and filter out items whose workspace is deleted

Signed-off-by: tygao <[email protected]>

* Changeset file for PR opensearch-project#8900 created/updated

* seperate link

Signed-off-by: tygao <[email protected]>

* update filter sequence

Signed-off-by: tygao <[email protected]>

---------

Signed-off-by: tygao <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
silva-qa pushed a commit to silva-qa/OpenSearch-Dashboards that referenced this pull request Dec 12, 2024
…rkspace is deleted (opensearch-project#8900)

* feat: optimize recent items and filter out items whose workspace is deleted

Signed-off-by: tygao <[email protected]>

* Changeset file for PR opensearch-project#8900 created/updated

* seperate link

Signed-off-by: tygao <[email protected]>

* update filter sequence

Signed-off-by: tygao <[email protected]>

---------

Signed-off-by: tygao <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Signed-off-by: Federico Silva <[email protected]>
Qxisylolo pushed a commit to Qxisylolo/OpenSearch-Dashboards that referenced this pull request Dec 23, 2024
…rkspace is deleted (opensearch-project#8900)

* feat: optimize recent items and filter out items whose workspace is deleted

Signed-off-by: tygao <[email protected]>

* Changeset file for PR opensearch-project#8900 created/updated

* seperate link

Signed-off-by: tygao <[email protected]>

* update filter sequence

Signed-off-by: tygao <[email protected]>

---------

Signed-off-by: tygao <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants