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.

Questions about importing tasks from their own files

See original GitHub issue

Hi,

I apologize if this has been answered before, I was looking through the issues and didnā€™t find it.

Are there any gotchas I should know about before putting task definitions in their own files? E.g. app/tasks/my-task.js and then importing as import myTask from "my-app/tasks/my-task"?

I understand that the concurrency is locked to the object that owns the task. If I have two different objects with this import and I use it in the object properties, do both objects own the same task definition (shared concurrency lock), or do they have separate concurrency patterns?

Is it better to export a generator function from the task file and wrap with task(...) in each usage, or export using the task(...) helper with the generator function in the task file and just add modifiers to each usage in different objects?

Thanks in advance

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
xtagoncommented, Aug 8, 2019

Thank you! That helps a lot šŸ‘

1reaction
maxfierkecommented, Aug 8, 2019

@xtagon The answer appears to be: Yes, you can export a task(...) and re-use it across components, and they will each maintain their own state. At least, in this limited Twiddle: https://ember-twiddle.com/576423fc578d8023b943ccf1c28bc9df I didnā€™t test it extensively, so perhaps thereā€™s some hidden gotchas. However, because task(...) returns a TaskProperty, which is a type of ComputedProperty, the semantics are similar to a computed property macro like reads or mapBy.

I think this has something to do with property descriptors. I donā€™t know enough about them to speak intelligently but perhaps thereā€™s a ā€œlate-bindingā€ thing that happens on assignment as a property on an object.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Possible to import tasks from a list or flat file? - Ivanti Community
Our Project Manager has asked if it is possible in the Project module to create tasks for a Project as an import from...
Read more >
Set up your import files - Knowledge Base - HubSpot
Learn how to set up your import file with sample spreadsheets and required ... Calls and tasks can be imported on their own,...
Read more >
How can I import tasks in Microsoft To Do ? (urgent)
Then, go to file > Open and export > Import/Export > Export to a file > Comma Separated Values > select your desired...
Read more >
Unable to load sub-tasks from CSV file - Atlassian Community
Hi Experts, I am trying to import sub-tasks from a CSV file, and link it to the tasks already existing in the system....
Read more >
Importing Your Task Lists and Tasks into Sisu
This article is meant to be a resource to help you download and complete the import spreadsheet on your own. However, if at...
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