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

Improve SVG performance by avoiding re-render when feature is clicked #3113

Merged
merged 1 commit into from
Jul 26, 2022

Conversation

cmdcolin
Copy link
Collaborator

@cmdcolin cmdcolin commented Jul 26, 2022

Currently, clicking a feature on the SVG track produces a re-rendering of all the features which can produce noticeable lag

This PR avoids this, and adds a test to make sure it stays that way. Incidentlally, that fix is a one liner and a regression, we just need to not dynamically create function props from within the render. This is the line https://github.com/GMOD/jbrowse-components/compare/test_rerender_svg?expand=1#diff-064ed32393d9637238ee6b5daa2f1ebe67829b1a3b719dc01cbd510ff45f6176R227

Also typescriptifies the SVG rendering unit tests to help ensure the right "API" is used

@github-actions github-actions bot added the needs label triage Needs a label to show in changelog (breaking, enhancement, bug, documentation, or internal) label Jul 26, 2022
@cmdcolin cmdcolin added bug Something isn't working enhancement New feature or request and removed needs label triage Needs a label to show in changelog (breaking, enhancement, bug, documentation, or internal) bug Something isn't working labels Jul 26, 2022
@cmdcolin cmdcolin changed the title Avoid rerendering all the SVG when feature is clicked Improve SVG feature speed by avoiding rerendering all the SVG when feature is clicked Jul 26, 2022
@cmdcolin cmdcolin changed the title Improve SVG feature speed by avoiding rerendering all the SVG when feature is clicked Improve SVG performance by avoiding re-render when feature is clicked Jul 26, 2022
@codecov
Copy link

codecov bot commented Jul 26, 2022

Codecov Report

Merging #3113 (14fc72e) into main (e5b74f5) will increase coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #3113      +/-   ##
==========================================
+ Coverage   58.84%   58.88%   +0.03%     
==========================================
  Files         644      644              
  Lines       28895    28895              
  Branches     7017     7017              
==========================================
+ Hits        17004    17014      +10     
+ Misses      11513    11503      -10     
  Partials      378      378              
Impacted Files Coverage Δ
...src/SvgFeatureRenderer/components/FeatureGlyph.tsx 94.11% <ø> (ø)
...src/SvgFeatureRenderer/components/FeatureLabel.tsx 86.11% <ø> (+5.55%) ⬆️
...g/src/SvgFeatureRenderer/components/SvgOverlay.tsx 47.29% <ø> (ø)
...FeatureRenderer/components/SvgFeatureRendering.tsx 75.78% <100.00%> (+3.15%) ⬆️
packages/core/util/layouts/GranularRectLayout.ts 87.28% <0.00%> (+0.42%) ⬆️
...FeatureRenderer/components/ProcessedTranscript.tsx 88.73% <0.00%> (+1.40%) ⬆️
...gins/svg/src/SvgFeatureRenderer/components/util.ts 95.91% <0.00%> (+4.08%) ⬆️
...svg/src/SvgFeatureRenderer/components/Segments.tsx 92.85% <0.00%> (+7.14%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us.

@cmdcolin cmdcolin merged commit 8d58870 into main Jul 26, 2022
@cmdcolin cmdcolin deleted the test_rerender_svg branch July 26, 2022 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant