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

Defer intersection monitoring until needed to prevent race conditions #7278

Merged
merged 5 commits into from
Dec 15, 2023

Conversation

scottbell
Copy link
Contributor

@scottbell scottbell commented Dec 6, 2023

Closes #7277

Describe your changes:

  • Wait to start observing for intersections (i.e., visibility) until renderWhenVisible is called once. This prevents every View needing to subscribe to intersection events, and prevents a race condition where the view isn't quite built yet.
  • Wait to start observing canvas for visibility until we've called draw once. Prevents similar race condition as above.
  • Update API documentation.

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 Dec 6, 2023 that may be closed by this pull request
7 tasks
Copy link

deploysentinel bot commented Dec 6, 2023

Current Playwright Test Results Summary

✅ 15 Passing

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

(Last updated on 12/15/2023 08:34:24am UTC)

Run Details

Running Workflow e2e-couchdb on Github Actions

Commit: 4dbb574

Started: 12/15/2023 08:32:41am UTC

View Detailed Build Results


Current Playwright Test Results Summary

✅ 165 Passing - ⚠️ 1 Flaky

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

(Last updated on 12/15/2023 08:34:24am UTC)

Run Details

Running Job e2e-stable on CircleCI

Commit: 4dbb574

Started: 12/15/2023 08:17:56am UTC

⚠️ Flakes

📄   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 Allows embeds to be deleted if page unlocked @addinit
Retry 1Initial Attempt
0% (0) 0 / 54 runs
failed over last 7 days
42.59% (23) 23 / 54 runs
flaked over last 7 days

View Detailed Build Results


Copy link

codecov bot commented Dec 6, 2023

Codecov Report

Merging #7278 (4dbb574) into master (4075a31) will decrease coverage by 0.05%.
The diff coverage is 80.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7278      +/-   ##
==========================================
- Coverage   55.96%   55.91%   -0.05%     
==========================================
  Files         655      655              
  Lines       26316    26324       +8     
  Branches     2543     2544       +1     
==========================================
- Hits        14728    14720       -8     
- Misses      10881    10891      +10     
- Partials      707      713       +6     
Flag Coverage Δ *Carryforward flag
e2e-full 41.79% <ø> (-0.01%) ⬇️ Carriedforward from 4075a31
e2e-stable 58.40% <100.00%> (-0.01%) ⬇️
unit 49.18% <20.00%> (-0.08%) ⬇️

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

Files Coverage Δ
src/utils/visibility/VisibilityObserver.js 96.55% <100.00%> (+0.71%) ⬆️
src/plugins/plot/chart/MctChart.vue 43.88% <33.33%> (+0.15%) ⬆️

... and 7 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 4075a31...4dbb574. Read the comment docs.

@scottbell scottbell added the pr:e2e:couchdb npm run test:e2e:couchdb label Dec 6, 2023
@scottbell scottbell changed the title Defer intersection checks until needed to prevent race conditions Defer intersection monitoring until needed to prevent race conditions Dec 6, 2023
@github-actions github-actions bot removed the pr:e2e:couchdb npm run test:e2e:couchdb label Dec 6, 2023
@scottbell
Copy link
Contributor Author

Before:

Before.mov

After:

After.mov

@ozyx ozyx added this to the Target:3.2.0 milestone Dec 12, 2023
@unlikelyzero unlikelyzero modified the milestones: Target:3.2.0, Target:3.3.0 Dec 12, 2023
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.

LGTM

@scottbell scottbell added the pr:e2e:couchdb npm run test:e2e:couchdb label Dec 13, 2023
@github-actions github-actions bot removed the pr:e2e:couchdb npm run test:e2e:couchdb label Dec 13, 2023
@unlikelyzero unlikelyzero added type:enhancement performance impacts or improves performance type:bug and removed type:enhancement labels Dec 14, 2023
@scottbell
Copy link
Contributor Author

@akhenry please let me know if there's anything else we need to test here

@scottbell scottbell added the pr:e2e:couchdb npm run test:e2e:couchdb label Dec 14, 2023
@github-actions github-actions bot removed the pr:e2e:couchdb npm run test:e2e:couchdb label Dec 14, 2023
@scottbell
Copy link
Contributor Author

@akhenry please let me know if there's anything else we need to test here

Merging for the interim, but can revert if we need.

@scottbell scottbell added the pr:e2e:couchdb npm run test:e2e:couchdb label Dec 15, 2023
@github-actions github-actions bot removed the pr:e2e:couchdb npm run test:e2e:couchdb label Dec 15, 2023
@scottbell scottbell merged commit 2675220 into master Dec 15, 2023
20 checks passed
@scottbell scottbell deleted the 7277-plots-sometimes-do-not-render-on-load branch December 15, 2023 08:40
@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 type:bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Plots sometimes do not render on load
3 participants