Allow useTask to be used outside of setup
See original GitHub issueThis could be useful for testing.
It seems the only blocker for this is the usage of onUnmounted() which would cause an error if used outside of setup. It could be conditionally turned off so that useTask() can be used anywhere.
const mockTask = useTask(function*() {
return "success";
}, { cancelOnUnmount: false });
const wrapper = mount(SaveButton, {
propsData: {
task,
},
});
task.perform();
expect(wrapper.find("button")).toBeDisabled();
});
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:14 (8 by maintainers)
Top Results From Across the Web
How to use task sequence variables - Configuration Manager
Click Add Condition, and select Task Sequence Variable. In the Task Sequence Variable dialog box, specify the following settings: Variable: The ...
Read more >Use Task with AsyncStream and avoid retain cycle
In our case we'll use it directly in the UIViewController, it's a good setup for the purpose of this example. First, let's setup...
Read more >Amazon ECS task definitions
A task definition is required to run Docker containers in Amazon ECS. The following are some of the parameters that you can specify...
Read more >Create and use task templates in Remote Desktop
You can save a task's settings as a template to reuse for future tasks. For example, if you always use certain copy options...
Read more >Use task queues - HubSpot Knowledge Base
Learn how to set up your tasks so you can complete them back to back within HubSpot's interface. Task views show you the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@dschmidt Thanks for the reminder. I’ll try to check the testing workflows with
cancelOnUnmount: falseand update that docs page and then close this issue 👍https://vue-concurrency.netlify.app/testing/
@rudolfbyker no, it still stands on top of composition api. It’s just that just like
refandcomputedcan be used outside of thesetupfunction, so can tasks now