question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: Expose the task modifiers and modifier args on a `Task` object

See original GitHub issue

I have an AsyncButton component which can be used to trigger single or parallel task performs on click.

Currently my API for controlling this requires knowledge of the task implementation to decide whether the button should be allowed to trigger additional tasks on click or disable the button when a single task is running:

<AsyncButton
  @allowConcurrency={{true}}
  @task={{this.someTask}}
/>

Ideally, I would like to remove the need for this allowConcurrency flag and instead derive this from the type of task or the modifiers, for example, if the button could check if it is a restartableTask, then the button would automatically disable concurrency, or if it were a standardTask with maxConcurrency = 2 and one task is only running, then allowConcurrency is true, but when the user clicks again, the AsyncButton component would detect hitting the allowConcurrency limit and then automatically disable additional concurrency until a task completes.

Ideally I suppose that the Task API would generically expose the type of modifier used and also any arguments passed to the modifier (include the default Task “modifier”).

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
maxfierkecommented, Jun 28, 2021

This dovetails nicely with the next RFC I’m working on, which is a public API for TaskFactory and opening up task modifiers for extension. All of this stuff already lives as private properties on tasks already, so I will play around with some notion of task metadata within that. Stay tuned!

0reactions
maxfierkecommented, Oct 27, 2021

@lougreenwood unfortunately didn’t quite get to exposing this info for the Task Modifiers RFC released in 2.2.0, as there were some dependencies on Scheduler stuff that needs some work to be made more visible, but that’s the next piece of work I’m going to work on for a 2.3.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Feature request: Expose the task modifiers and modifier args on a ...
I have an AsyncButton component which can be used to trigger single or parallel task performs on click. Currently my API for controlling...
Read more >
Task Modifiers - ember-concurrency
Let's say we want to build a benchmarking modifier to help us get a sense for how long our tasks are running. //...
Read more >
Pass attributes to glimmer components when using ... - GitHub
I believe something like with-attributes and with-modifiers would require changes in the VM itself. The VM internally has a representation of a CurriedComponent ......
Read more >
4. Methods Use Instance Variables: How Objects Behave
A method uses parameters. A caller passes arguments. Arguments are the things you pass into the methods. An argument (a value like 2 ......
Read more >
Understanding Task Modifiers in Swift (iOS 15 and Xcode 13)
In this video, Mohammad Azam will demonstrate how to use the new task modifier in iOS 15 and Xcode 13. #SwiftUI, #SwiftLanguage ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found