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

Destroy canvas in plots if not visible #7263

Merged

Conversation

scottbell
Copy link
Contributor

@scottbell scottbell commented Nov 30, 2023

Closes #7202

Describe your changes:

Add an intersection observer to destroy the canvas when we've detected we're not visible.

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Is this change backwards compatible? For example, developers won't need to change how they are calling the API or how they've extended core plugins such as Tables or Plots.

Author Checklist

  • Changes address original issue?
  • Tests included and/or updated with changes?
  • Command line build passes?
  • Has this been smoke tested?
  • Testing instructions included in associated issue OR is this a dependency/testcase change?

Reviewer Checklist

  • Changes appear to address issue?
  • Reviewer has tested changes by following the provided instructions?
  • Changes appear not to be breaking changes?
  • Appropriate automated tests included?
  • Code style and in-line documentation are appropriate?
  • Has associated issue been labelled unverified? (only applicable if this PR closes the issue)
  • Has associated issue been labelled bug? (only applicable if this PR is for a bug fix)

@scottbell scottbell linked an issue Nov 30, 2023 that may be closed by this pull request
@scottbell scottbell changed the title first draft Destroy canvas in plots if not visible Nov 30, 2023
Copy link

deploysentinel bot commented Nov 30, 2023

Current Playwright Test Results Summary

✅ 14 Passing

Run may still be in progress, this comment will be updated as current testing workflow or job completes...

(Last updated on 12/04/2023 09:28:14pm UTC)

Run Details

Running Workflow e2e-couchdb on Github Actions

Commit: f9657f5

Started: 12/04/2023 09:26:44pm UTC

View Detailed Build Results


Current Playwright Test Results Summary

✅ 162 Passing - ⚠️ 4 Flaky

Run may still be in progress, this comment will be updated as current testing workflow or job completes...

(Last updated on 12/04/2023 09:28:14pm UTC)

Run Details

Running Job e2e-stable on CircleCI

Commit: f9657f5

Started: 12/04/2023 09:11:00pm UTC

⚠️ Flakes

📄   functional/plugins/plot/logPlot.e2e.spec.js • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Log plot tests Log Plot ticks are functionally correct in regular and log mode and after refresh
Retry 1Initial Attempt
0% (0) 0 / 42 runs
failed over last 7 days
28.57% (12) 12 / 42 runs
flaked over last 7 days

📄   functional/plugins/tabs/tabs.e2e.spec.js • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Tabs View Renders tabbed elements
Retry 1Initial Attempt
0% (0) 0 / 40 runs
failed over last 7 days
2.50% (1) 1 / 40 run
flaked over last 7 days

📄   functional/planning/timelist.e2e.spec.js • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Time List Create a Time List, add a single Plan to it and verify all the activities are displayed with no milliseconds
Retry 1Initial Attempt
1.56% (1) 1 / 64 run
failed over last 7 days
53.13% (34) 34 / 64 runs
flaked over last 7 days

📄   functional/plugins/notebook/restrictedNotebook.e2e.spec.js • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Restricted Notebook with a page locked and with an embed @addinit Disallows embeds to be deleted if page locked @addinit
Retry 1Initial Attempt
2.44% (1) 1 / 41 run
failed over last 7 days
34.15% (14) 14 / 41 runs
flaked over last 7 days

View Detailed Build Results


Copy link

codecov bot commented Nov 30, 2023

Codecov Report

Merging #7263 (f9657f5) into master (2dc1388) will decrease coverage by 0.04%.
The diff coverage is 83.72%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7263      +/-   ##
==========================================
- Coverage   56.04%   56.01%   -0.04%     
==========================================
  Files         654      654              
  Lines       26229    26256      +27     
  Branches     2528     2536       +8     
==========================================
+ Hits        14699    14706       +7     
- Misses      10828    10845      +17     
- Partials      702      705       +3     
Flag Coverage Δ *Carryforward flag
e2e-full 41.89% <ø> (-0.03%) ⬇️ Carriedforward from 2dc1388
e2e-stable 58.38% <100.00%> (-0.02%) ⬇️
unit 49.29% <83.72%> (-0.01%) ⬇️

*This pull request uses carry forward flags. Click here to find out more.

Files Coverage Δ
src/plugins/plot/draw/DrawWebGL.js 90.26% <100.00%> (ø)
src/utils/visibility/VisibilityObserver.js 95.83% <ø> (-0.17%) ⬇️
src/plugins/plot/chart/MctChart.vue 43.29% <81.57%> (-0.27%) ⬇️

... and 8 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2dc1388...f9657f5. Read the comment docs.

@scottbell
Copy link
Contributor Author

Fun to watch the canvas being destroyed:

Screen.Recording.2023-11-30.at.1.56.47.PM.mov

@scottbell scottbell marked this pull request as ready for review November 30, 2023 13:19
@scottbell scottbell added the pr:e2e:couchdb npm run test:e2e:couchdb label Nov 30, 2023
@github-actions github-actions bot removed the pr:e2e:couchdb npm run test:e2e:couchdb label Nov 30, 2023
@scottbell scottbell requested a review from ozyx November 30, 2023 18:59
@scottbell scottbell added the pr:e2e:couchdb npm run test:e2e:couchdb label Nov 30, 2023
@github-actions github-actions bot removed the pr:e2e:couchdb npm run test:e2e:couchdb label Nov 30, 2023
Copy link
Collaborator

@unlikelyzero unlikelyzero left a comment

Choose a reason for hiding this comment

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

👏

// expect two canvases (i.e., overlay & main canvas for sine wave generator) to be visible
await expect(page.locator('canvas')).toHaveCount(2);
await expect(page.locator('canvas').nth(0)).toBeVisible();
await expect(page.locator('canvas').nth(1)).toBeVisible();
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice

@ozyx ozyx enabled auto-merge (squash) December 4, 2023 21:08
@ozyx ozyx added the pr:e2e:couchdb npm run test:e2e:couchdb label Dec 4, 2023
@ozyx ozyx added this to the Target:3.3.0 milestone Dec 4, 2023
@github-actions github-actions bot removed the pr:e2e:couchdb npm run test:e2e:couchdb label Dec 4, 2023
@ozyx ozyx merged commit e7b9481 into master Dec 4, 2023
15 checks passed
@ozyx ozyx deleted the 7202-have-webgl-contexts-eagerly-lose-context-when-not-visible branch December 4, 2023 21:28
@ozyx ozyx added the performance impacts or improves performance label Dec 4, 2023
@unlikelyzero unlikelyzero modified the milestones: Target:3.3.0, Target:4.0.0 Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance impacts or improves performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Have WebGL contexts eagerly lose context when not visible
3 participants