MartinMalinda / vue-concurrency

A library for encapsulating asynchronous operations and managing concurrency for Vue and Composition API.

Home Page:https://vue-concurrency.netlify.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve performance of drop()

MartinMalinda opened this issue · comments

These optimizations might be useful if the task is used very extensively, on scroll or raf or smilar (intense throttling).

Task is being marked as drop after quite some work of creating a new reactive object. Dropped task instance never changes though and all the set up of reactive() and computed() is not needed.

A simple static object that implements the TaskInterface could be returned right away.


Alternatively, a task could be set up not to even create dropped task instances and just early return from perform().

// for those who are brave
const task = useTask(function * () { /* ... */ }).drop({ void: true });