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

更改动画占用内存,持续不放的问题 #4357

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LuckyTaoTao
Copy link

@LuckyTaoTao LuckyTaoTao commented Jul 8, 2024

Description

const animations = (edge, path, duration) => { let timeoutId; return new Promise((resolve) => { edge.transition(path, 1, { duration: duration, timing: Timing.linear, delay: 0, complete: ({ cell, path }) => { if (animationRunning.value) { resolve(); cell.updateAttrs( { arrow1: { atConnectionRatio: 0 }, }, { silent: true } ); timeoutId = setTimeout(() => animations(cell, path, duration), 500); } else { resolve(); // 停止动画循环时,也要正常完成Promise } }, }); if (timeoutId) { clearTimeout(timeoutId); } }); };
this.queue在动画循环下,会持续增加,导致百万级别不释放,最后内存不释放

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Enhancement (changes that improvement of current feature or performance)
  • Refactoring (changes that neither fixes a bug nor adds a feature)
  • Test Case (changes that add missing tests or correct existing tests)
  • Code style optimization (changes that do not affect the meaning of the code)
  • Docs (changes that only update documentation)
  • Chore (changes that don't modify src or test files)

Self Check before Merge

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@x6-bot x6-bot bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jul 8, 2024
@x6-bot
Copy link
Contributor

x6-bot bot commented Jul 8, 2024

👋 @LuckyTaoTao

💖 Thanks for opening this pull request! 💖

Please follow the contributing guidelines. And we use semantic commit messages to streamline the release process.

Examples of commit messages with semantic prefixes:

  • fix: don't overwrite prevent_default if default wasn't prevented
  • feat: add graph.scale() method
  • docs: graph.getShortestPath is now available

Things that will help get your PR across the finish line:

  • Follow the TypeScript, JavaScript, CSS and React coding style.
  • Run npm run lint locally to catch formatting errors earlier.
  • Document any user-facing changes you've made.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

@x6-bot x6-bot bot added pkg:x6 PR: unreviewed PR does not have any reviews. labels Jul 8, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jul 8, 2024

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 10.34%. Comparing base (a431f52) to head (1d75a1e).
Report is 6 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4357   +/-   ##
=======================================
  Coverage   10.34%   10.34%           
=======================================
  Files         180      180           
  Lines       10582    10582           
  Branches     2580     2580           
=======================================
  Hits         1095     1095           
  Misses       9398     9398           
  Partials       89       89           
Flag Coverage Δ
x6 10.34% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
packages/x6/src/model/animation.ts 3.79% <0.00%> (ø)
packages/x6/src/renderer/queueJob.ts 8.21% <0.00%> (ø)

@@ -12,7 +12,8 @@ export class JobQueue {
} else {
const index = this.findInsertionIndex(job)
if (index >= 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

这里为什么要重复判断呀?index > 0 已经说明这个 job 存在呀。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:x6 PR: unreviewed PR does not have any reviews. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants