Skip to content

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 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 labels Jul 8, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jul 8, 2024

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 10.29%. Comparing base (221a018) to head (9f40890).

Files with missing lines Patch % Lines
packages/x6/src/model/animation.ts 0.00% 1 Missing ⚠️
packages/x6/src/renderer/queueJob.ts 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4357   +/-   ##
=======================================
  Coverage   10.29%   10.29%           
=======================================
  Files         180      180           
  Lines       10620    10620           
  Branches     2590     2590           
=======================================
  Hits         1093     1093           
  Misses       9438     9438           
  Partials       89       89           
Flag Coverage Δ
x6 10.29% <0.00%> (ø)

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

Files with missing lines Coverage Δ
packages/x6/src/model/animation.ts 3.79% <0.00%> (ø)
packages/x6/src/renderer/queueJob.ts 8.21% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

job.cb()
} 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 存在呀。

@hustcc
Copy link
Member

hustcc commented Jul 22, 2025

@LuckyTaoTao 抽空看看 code review 的内容。

@archersado
Copy link

确实存在这个问题,当多个 animation 同时执行时,queueJob 的速度比 flushJob 的速度快,就存在 job 堆积,目前是在动画 complete 的时候手动调用 queue.clearJobs 来解决的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants