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

Ensure previews work for plots #7459

Merged

Conversation

scottbell
Copy link
Contributor

@scottbell scottbell commented Feb 5, 2024

Closes #7446
Closes #7535

Describe your changes:

  1. In Preview mode, ensure our renderWhenVisible function always fires
  2. Remove "existingView" logic from PreviewContainer

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?
  • Has this been smoke tested?
  • Have you associated this PR with a type: label? Note: this is not necessarily the same as the original issue.
  • Have you associated a milestone with this PR? Note: leave blank if unsure.
  • Is this a breaking change to be called out in the release notes?
  • 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?

@scottbell scottbell linked an issue Feb 5, 2024 that may be closed by this pull request
7 tasks
Copy link

codecov bot commented Feb 5, 2024

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

Comparison is base (0aceb4b) 55.37% compared to head (97ba153) 51.85%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7459      +/-   ##
==========================================
- Coverage   55.37%   51.85%   -3.53%     
==========================================
  Files         671      671              
  Lines       26920    26930      +10     
  Branches     2614     2614              
==========================================
- Hits        14908    13964     -944     
- Misses      11297    12250     +953     
- Partials      715      716       +1     
Flag Coverage Δ *Carryforward flag
e2e-full 48.93% <ø> (+0.01%) ⬆️ Carriedforward from 0aceb4b
e2e-stable ?
unit 48.35% <57.14%> (-0.04%) ⬇️

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

Files Coverage Δ
src/api/overlays/Overlay.js 94.44% <100.00%> (+0.32%) ⬆️
src/plugins/plot/draw/DrawWebGL.js 89.38% <100.00%> (-1.77%) ⬇️
src/ui/components/ObjectFrame.vue 4.16% <0.00%> (ø)
src/plugins/plot/chart/MctChart.vue 43.01% <80.00%> (-0.47%) ⬇️
src/ui/preview/PreviewAction.js 72.00% <33.33%> (-15.50%) ⬇️
src/utils/visibility/VisibilityObserver.js 72.72% <0.00%> (-17.28%) ⬇️

... and 124 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 0aceb4b...97ba153. Read the comment docs.

@scottbell scottbell changed the title Ensure previews always render Ensure previews work for plots Feb 5, 2024
@scottbell scottbell added this to the Target:4.0.0 milestone Feb 5, 2024
@scottbell scottbell requested a review from ozyx February 5, 2024 13:27
@scottbell scottbell added the pr:e2e:couchdb npm run test:e2e:couchdb label Feb 5, 2024
@github-actions github-actions bot removed the pr:e2e:couchdb npm run test:e2e:couchdb label Feb 5, 2024
@scottbell scottbell marked this pull request as ready for review February 5, 2024 13:37
@@ -61,6 +61,7 @@ class Overlay extends EventEmitter {
dismiss() {
this.emit('destroy');
this.destroy();
this.container.remove();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

overlays were stacking up!

root: rootContainer,
rootMargin: '0px',
threshold: 1.0
root: rootContainer
Copy link
Contributor Author

@scottbell scottbell Feb 5, 2024

Choose a reason for hiding this comment

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

we need defaults here (specifically the 0 threshold) so our callback runs when the whole canvas is gone, or if a single pixel of the canvas is visible. this keeps the intersection conservative in its definition of "visible"

if (!this.chartVisible) {
// destroy the chart
const isNowVisible = entry.isIntersecting;
const chartInOverlayWindow = this.chartContainer?.closest('.js-overlay') !== null;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

intersection observers in previews behave badly as the overlay covers our root element! try to detect that we're in one.

element: vNode.el,
size: 'large',
autoHide: false,
buttons: [
{
label: 'Done',
callback: () => overlay.dismiss()
callback: () => {
overlay.dismiss();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

overlays were stacking up!

Copy link
Contributor

Choose a reason for hiding this comment

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

oooo nice catch

#observerCallback = ([entry]) => {
if (entry.target === this.#element) {
this.isIntersecting = entry.isIntersecting;
if (this.#inOverlay() && !entry.isIntersecting) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

same issue as renderWhenVisible

@scottbell scottbell added the pr:e2e:couchdb npm run test:e2e:couchdb label Feb 5, 2024
@scottbell scottbell added pr:e2e:couchdb npm run test:e2e:couchdb and removed pr:e2e:couchdb npm run test:e2e:couchdb labels Feb 5, 2024
Copy link
Contributor

@ozyx ozyx left a comment

Choose a reason for hiding this comment

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

Nice work!

@ozyx ozyx removed the pr:e2e:couchdb npm run test:e2e:couchdb label Feb 6, 2024
@ozyx ozyx added the pr:e2e:couchdb npm run test:e2e:couchdb label Feb 6, 2024
@github-actions github-actions bot removed the pr:e2e:couchdb npm run test:e2e:couchdb label Feb 6, 2024
@scottbell scottbell merged commit eeb8e97 into master Feb 6, 2024
46 checks passed
@scottbell scottbell deleted the 7446-large-view-for-telemetry-doesnt-show-any-plot branch February 6, 2024 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants